pax_global_header00006660000000000000000000000064135720113160014511gustar00rootroot0000000000000052 comment=c4f5ba467538859a036a854f2b65c818192f9c1b csg-1.6_rc1/000077500000000000000000000000001357201131600127005ustar00rootroot00000000000000csg-1.6_rc1/.codecov.yml000066400000000000000000000001441357201131600151220ustar00rootroot00000000000000coverage: precision: 1 round: down range: "70...100" ignore: - /usr/include/ - src/tests/ csg-1.6_rc1/.gitignore000066400000000000000000000023261357201131600146730ustar00rootroot00000000000000*~ csg_*.man csg_*.t2t csg_*.help libvotca*.a libvotca*.so libvotca*.so.* Makefile rules.ninja build.ninja .ninja_* build scripts/csg_call scripts/csg_inverse scripts/help2t2t scripts/csg_inverse.t2t scripts/*.out share/doc/Doxyfile share/doc/html/* share/man/*.man share/template/template_serial share/template/template_threaded share/xml/csg_defaults.xml src/csg_boltzmann/csg_boltzmann src/libcsg/version.cc src/tools/csg_dump src/tools/csg_fmatch src/tools/csg_gmxtopol src/tools/csg_map src/tools/csg_property src/tools/csg_resample src/tools/csg_stat src/tools/csg_part_dist src/tools/csg_density src/tools/csg_reupdate src/tools/csg_dlptopol share/scripts/inverse/*.pyc __pycache__/ netbeans src/libcsg/gitversion.h src/libcsg/votca_config.h netbeans/*/build netbeans/*/dist src/csg_boltzmann/build */nbproject/private Makefile-variables.mk Package-Debug.bash Package-Release.bash Package-profile_release.bash netbeans/libcsg/nbproject/private/ CMakeFiles cmake_install.cmake cmake_uninstall.cmake CMakeCache.txt install_manifest.txt netbeans/libcsg/nbproject/Makefile-Debug.mk netbeans/libcsg/nbproject/Makefile-Release.mk netbeans/libcsg/nbproject/Makefile-impl.mk netbeans/libcsg/nbproject/Makefile-profile_release.mk build* csg-1.6_rc1/.gitlab-ci.yml000066400000000000000000000176121357201131600153430ustar00rootroot00000000000000stages: - canary - build .build: retry: max: 2 variables: CCACHE_DIR: "${CI_PROJECT_DIR}/ccache" DISTRO: "latest" image: votca/buildenv:${DISTRO} stage: build artifacts: paths: - ${CI_PROJECT_DIR}/votca when: always dependencies: [] cache: paths: - ccache/ script: - ccache -z - j="$(grep -c processor /proc/cpuinfo 2>/dev/null)" || j=0; ((j++)) - git branch commit_of_build_${CI_BUILD_ID} ${CI_COMMIT_SHA} - git clone https://github.com/votca/votca - pushd votca - if [[ ${CI_COMMIT_TAG} = v[12].[0-9]* ]]; then git checkout -b ${CI_COMMIT_TAG} ${CI_COMMIT_TAG}; elif [[ ( ${CI_COMMIT_REF_NAME} =~ ^for/([^/]*)/.* || ${CI_COMMIT_REF_NAME} =~ ^(stable)$ ) && ${BASH_REMATCH[1]} != master ]]; then git checkout -b ${BASH_REMATCH[1]} origin/${BASH_REMATCH[1]}; fi - git submodule update --recursive --init - git -C ${CI_PROJECT_NAME} fetch ${CI_PROJECT_DIR} commit_of_build_${CI_BUILD_ID} - git -C ${CI_PROJECT_DIR} branch -d commit_of_build_${CI_BUILD_ID} - git -C ${CI_PROJECT_NAME} checkout -f ${CI_COMMIT_SHA} - mkdir -p build - pushd build - cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTING=ON -DBUILD_CSGAPPS=ON -DBUILD_XTP=ON -DBUILD_CSG_MANUAL=ON -DENABLE_WERROR=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DENABLE_REGRESSION_TESTING=${REGRESSION_TESTING:-ON} -DBUILD_OWN_GROMACS=${BUILD_GROMACS} ${BUILD_GROMACS:+-DENABLE_WARNING_FLAGS=OFF} -DMODULE_BUILD=${MODULE_BUILD} ${MODULE_BUILD:+-DCMAKE_INSTALL_PREFIX=/home/votca/votca.install} ${MINIMAL:+-DCMAKE_DISABLE_FIND_PACKAGE_HDF5=ON -DCMAKE_DISABLE_FIND_PACKAGE_FFTW3=ON -DCMAKE_DISABLE_FIND_PACKAGE_MKL=ON -DBUILD_MANPAGES=OFF -DWITH_GMX=OFF -DBUILD_XTP=OFF -DENABLE_REGRESSION_TESTING=OFF} - cmake --build . -- -j2 - ctest --output-on-failure - test -z "${MODULE_BUILD}" && DESTDIR=${PWD}/install cmake --build . --target install && rm -rf ${PWD}/install/usr && rmdir ${PWD}/install - sudo cmake --build . --target install - if [[ ${CLANG_FORMAT} ]]; then cmake --build . --target format && git -C ${CI_PROJECT_DIR}/votca/${CI_PROJECT_NAME} diff --exit-code; fi - ccache -s Debug GCC: stage: canary variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Debug" CLANG_FORMAT: "yes" extends: .build None GCC: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "" extends: .build None Clang: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "" extends: .build Debug Clang: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Debug" extends: .build Release GCC: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" extends: .build Release Clang: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" extends: .build Debug GCC Ubuntu: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Debug" DISTRO: "ubuntu" extends: .build Debug Clang Ubuntu: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Debug" DISTRO: "ubuntu" extends: .build Release GCC Ubuntu: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "ubuntu" extends: .build Release Clang Ubuntu: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "ubuntu" extends: .build Debug GCC Rawhide: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Debug" DISTRO: "fedora_rawhide" extends: .build allow_failure: true Debug Clang Rawhide: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Debug" DISTRO: "fedora_rawhide" extends: .build allow_failure: true Release GCC Rawhide: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_rawhide" extends: .build allow_failure: true Release Clang Rawhide: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_rawhide" extends: .build allow_failure: true Release GCC Minimal: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" MINIMAL: "yes" DISTRO: "fedora_nogmx" extends: .build Release Clang Minimal: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" MINIMAL: "yes" DISTRO: "fedora_nogmx" extends: .build Release GCC Module: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" MODULE_BUILD: "yes" extends: .build Release GCC GMX2016: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2016" extends: .build Release Clang GMX2016: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2016" extends: .build Release GCC GMX2016D: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2016_d" extends: .build Release Clang GMX2016D: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2016_d" extends: .build Release GCC GMX2018: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2018" extends: .build Release Clang GMX2018: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2018" extends: .build Release GCC GMX2018D: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2018_d" extends: .build Release Clang GMX2018D: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2018_d" extends: .build Release GCC GMX2019: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2019" extends: .build Release Clang GMX2019: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2019" extends: .build Release GCC GMX2019D: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2019_d" extends: .build Release Clang GMX2019D: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2019_d" extends: .build Release GCC GMX2020: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2020" REGRESSION_TESTING: "OFF" extends: .build Release Clang GMX2020: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2020" REGRESSION_TESTING: "OFF" extends: .build Release GCC GMX2020D: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2020_d" REGRESSION_TESTING: "OFF" extends: .build Release Clang GMX2020D: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx2020_d" REGRESSION_TESTING: "OFF" extends: .build Release GCC GMX9999: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx9999" REGRESSION_TESTING: "OFF" extends: .build allow_failure: true Release Clang GMX9999: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx9999" REGRESSION_TESTING: "OFF" extends: .build allow_failure: true Release GCC GMX9999D: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx9999_d" REGRESSION_TESTING: "OFF" extends: .build allow_failure: true Release Clang GMX9999D: variables: CC: "clang" CXX: "clang++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_gmx9999_d" REGRESSION_TESTING: "OFF" extends: .build allow_failure: true Release GCC OWN GMX: variables: CC: "gcc" CXX: "g++" CMAKE_BUILD_TYPE: "Release" DISTRO: "fedora_nogmx" BUILD_GROMACS: "yes" extends: .build csg-1.6_rc1/.travis.yml000066400000000000000000000104131357201131600150100ustar00rootroot00000000000000# the original source of this file can be found in votca/votca repository # add changes there! # To update: # wget -O .travis.yml https://raw.githubusercontent.com/votca/votca/master/.travis.yml language: cpp sudo: required services: - docker git: quiet: true stages: - canary - test - deploy jobs: include: - stage: canary env: ENV=3 - stage: deploy if: repo = votca/votca AND type != pull_request env: ENV=1 env: matrix: - ENV=1 - ENV=2 - ENV=3 - ENV=4 - ENV=5 - ENV=6 - ENV=7 - ENV=8 - ENV=9 - ENV=10 - ENV=11 - ENV=12 - ENV=13 - ENV=14 - ENV=15 - ENV=16 - ENV=17 - ENV=18 - ENV=19 - ENV=20 before_script: - git checkout -b current_commit - cd ../../ - if [[ ${TRAVIS_REPO_SLUG} = */votca ]]; then if [[ ${TRAVIS_BRANCH} = next ]]; then git -C ${TRAVIS_REPO_SLUG} submodule foreach git checkout master; git -C ${TRAVIS_REPO_SLUG} submodule foreach git pull; fi; cp -vr ${TRAVIS_REPO_SLUG}/docker ${HOME}; mv -v ${TRAVIS_REPO_SLUG} $HOME/docker; else git clone -q --recursive https://github.com/votca/votca.git $HOME/docker/votca; if [[ ${TRAVIS_BRANCH} != master ]]; then git -C ${HOME}/docker/votca checkout -b ${TRAVIS_BRANCH} ${TRAVIS_TAG:-origin/${TRAVIS_BRANCH}} && git -C ${HOME}/docker/votca submodule update --recursive --init; fi; git -C ${HOME}/docker/votca/${TRAVIS_REPO_SLUG#*/} fetch ${PWD}/${TRAVIS_REPO_SLUG} current_commit; git -C ${HOME}/docker/votca/${TRAVIS_REPO_SLUG#*/} checkout -f FETCH_HEAD; cp -vr ${HOME}/docker/votca/docker/* ${HOME}/docker; if [[ -d ${TRAVIS_REPO_SLUG}/docker ]]; then cp -vr ${TRAVIS_REPO_SLUG}/docker/* ${HOME}/docker; fi; fi - source ${HOME}/docker/set_env.sh - test -n "${SKIP}" || cp -r $HOME/.ccache ${HOME}/docker/ccache - sed -i "1s/latest/${DISTRO:-latest}/" ${HOME}/docker/Dockerfile - if [[ ! ${SKIP} ]]; then travis_retry timeout 540 docker pull $(sed -n '1s/FROM //p' ${HOME}/docker/Dockerfile) | cat; fi script: - if [[ ! ${SKIP} ]]; then travis_retry docker build "${docker_opts[@]}" ${TRAVIS_TAG:+-t votca/votca:${TRAVIS_TAG}} -t votca/votca:latest -t votca/votca:${TRAVIS_BRANCH} ${HOME}/docker/ && rm -rf $HOME/.ccache && CON=$(docker run -d votca/votca:${TRAVIS_BRANCH} /bin/bash) && docker cp ${CON}:/home/votca/.ccache ${HOME}/; fi after_success: - if [[ ${TRAVIS_REPO_SLUG} != votca/votca || ${TRAVIS_BUILD_STAGE_NAME} != "Deploy" || ${SKIP} ]]; then travis_terminate 0; fi - shopt -s extglob && [[ ${TRAVIS_BRANCH} = @(master|stable|v1.*) ]] && DEPLOY=yes - if [[ ${TRAVIS_BRANCH} = master ]]; then DOCKER_TAG=latest; else DOCKER_TAG="${TRAVIS_BRANCH}"; fi - if [[ ${DOCKER_USERNAME} && ${DOCKER_PASSWORD} && ${TRAVIS_PULL_REQUEST} == false && ${DEPLOY} ]]; then docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"; docker push "${TRAVIS_REPO_SLUG}:${DOCKER_TAG}"; fi - if true; then git clone --depth=1 https://github.com/votca/doxygen.git "$HOME/devdoc"; cd $HOME/devdoc; rm -f *; git checkout -- CNAME; docker cp ${CON}:/home/votca/votca/build/share/doc/html . ; mv html/* .; rmdir html; docker cp ${CON}:/home/votca/votca/build/csg-manual/manual.pdf . ; docker cp ${CON}:/home/votca/votca/build/xtp/manual/xtp-manual.pdf . ; git add --all .; if [[ ${TRAVIS_BRANCH} = master && ${encrypted_7abbb71c3ba6_key} && ${encrypted_7abbb71c3ba6_iv} && ${TRAVIS_PULL_REQUEST} == false ]]; then git config --global user.name "Automatic Deployment (Travis CI)"; git config --global user.email "votca-commits@googlegroups.com"; git commit -m "Documentation Update"; openssl aes-256-cbc -K $encrypted_7abbb71c3ba6_key -iv $encrypted_7abbb71c3ba6_iv -in keys/deploy3.enc -out ~/.ssh/id_rsa -d; chmod 600 ~/.ssh/id_rsa; git push git@github.com:votca/doxygen.git gh-pages; else git status; git diff --cached --no-color | head -c 1k; fi; fi branches: only: - master - development - stable - next - /^v\d+\.\d+(\.\d+|_rc\d+)?$/ cache: - ccache compiler: - gcc - clang notifications: email: - votca-commits@googlegroups.com csg-1.6_rc1/CHANGELOG.md000066400000000000000000000215201357201131600145110ustar00rootroot00000000000000For more detailed information about the changes see the history of the [repository](https://github.com/votca/csg/commits/master). ## Version 1.6_rc1 (released 04.12.19) * Major CMake refactor * Improved file readers * Added more tests * Added csg_imc_solve, removing octave and python solvers ## Version 1.5.1 (released 20.11.19) * bug fixes for gcc-5 * some bugfixes for the lammps reader * support dynamics box size in h5md * fix build on CentOs7 ## Version 1.5 _SuperVictor_ (released 31.01.19) * enable gitlab CI ## Version 1.5_rc3 (released 19.01.19) * travis: fixed bug in building tags * cmake: only run csg_dump test if bash was found ## Version 1.5_rc2 (released 16.01.19) * added REGRESSIONTEST_TOLERANCE cmake option * added bug fix for memory leak in bead class * added topology unit test ## Version 1.5_rc1 (released 28.12.18) * added support for 3 body distribution * allow usage of \_ in gmx options * support espresso-4.0 * added LAMMPS data topology reader * added LAMMPS dump writer * added support for gmx-2019 * move from gsl to Eigen3 * added support for running gmx in multidir mode * extended pdb reader to read CONECT section * reworked perl interface to fix #179 * make most install locations configureable * allow to change pot extrapolation fct for LAMMPS * dropped support for gmx-5.1 * added unit and regression tests ## Version 1.4.1 (released 02.09.17) * fix pkg-config files * fix build with gmx-2017 * added CSG_MDRUN_OPTS to run_gromacs.sh * table_to_tab.pl: fix forces for LAMMPS * csg_inverse: warn users of bug #179 * run_gromacs.sh: check nstxout-compressed * tools: fix parallel build with mkl ## Version 1.4 _SuperKurt_ (released 29.10.16) * added cibi tutorial and manual section * install mkl headers if mkl is enabled * updated copyright * xmltopologyparser: tokenize on \\n and \\t as well (#195) * tools: added support for boost-1.62 ## Version 1.4_rc1 (released 26.09.16) * switch to c++-11 * dihedral support in csg_fmatch * support for tabulated bond in >=gmx-5 * added full featured XMLTopologyReader * added regularization for IMC * changed neighborlist from std::list to std::vector * added cibi method * tools: added support for mkl as gsl replacement * lots of reader bug fixes * dropped support for gromacs-4 and clean up * dropped multi_g_rdf script * dropped thermforce iteration method * moved h5md reader to hdf5 without c++ api ## Version 1.3.1 (released 19.08.16) * histogram: use floor() on bin value * calculator: fixed namespace * VOTCARC: added shebang * fixed gromacs detection with >=cmake-3.4 ## Version 1.3 _SuperUzma_ (released 15.01.16) * re-implemented csg_boltzmann --excl * added support for upcoming gromacs 2016 ## Version 1.3_rc1 (released 23.09.15) * added new iterative methods: relative entropy, simplex optimization * added support for using the following with iterative methods: hoomd-blue, lammps, ESPResSo, ESPResSo++, dl_poly * added pre-simulation feature for GROMACS (e.g. for minimization) * added rudimentary support for IBI with bonded interaction * made pdb reader work with libgmx * added support for h5md, dl_ploy file format * added support for numpy in IMC * cmake: added BUILD_MANPAGES option, git support minor fixes * cmake: dropped internal boost replacement * many many many small bug fixes and improvements ## Version 1.2.4 (released 31.08.14) * support for Gromacs 5.0 * support for Boost 1.53 * fixed use of nawk instead of gawk under MacOs * fixed python shebang * fixed linking issue under Fedora * fixed thermforce calculation for xsplit case ## Version 1.2.3 (released 14.08.12) * improved AIX support * fixed install on 64-bit linux systems * fixed a bug in histogram class * fixed rdf calculation for r_min > 0 (histogram bug) * updated documentation ## Version 1.2.2 (released 10.01.12) * added numpy solver for IMC * cmake: updated FindGROMACS.cmake * fixed coredump in csg_property (issue 114) * fixed namespace in Fedora * fixed problem with newlines in csg_property * cmake: allow static fftw and gsl * added dummy c function for cmake * fixed conflicting type headers (real was defined) ## Version 1.2.1 (released 25.08.11) * csg_inverse: improve initial guess of the potential * csg_inverse: fixes for min!=0 * table_extrapolate.pl: fixed flags and first point * fixed tf iteration for multiple components * fixed round-off error in grid search and csg_calc * csg_inverse: typo fixed and additional checks * fixed soname of libs * improved cmake checks and error messages * fixed pkg-config file ## Version 1.2 _SuperDoris_ (released 17.06.11) * changed buildsystem to cmake * added thermforce iteration method * added csg_density * a lot of framework clean up * added type selector name:\* * allow long and restart of simulations * added database class through sqlite3 ## Version 1.1.2 (released 04.04.11) * csg_fmatch: added support for known forces (--trj-force option) * fixed head of votca.7 manpage ## Version 1.1.1 (released 01.03.11) * fixed csg_inverse --clean * make postupdate pressure work again * fixed bug when reading exclusions from tpr * end with error in csg_stat if bead type does not exist (issue 77) ## Version 1.1 _SuperAnn_ (released 18.02.11) * added support for gromacs 5.0 * csg_dump: can dump exclusion * added boundarycondition class * added man pages, man7 and man1 for all bins * csg_inverse: renamed ibm to ibi * csg_inverse: many internal improvements * csg_stat: added: thread support, read exclusions from tpr file, uses grid search by default * csg_inverse: added: convergence check, postadd plot, better logging, weaker die * csg_resample: added boundary conditions option and akima spline support * csg_stat or csg_fmatch give an error if trj not given (issue 29) * csg_get_interaction_property knows about defaults * fixed segfault in mapping (Fixes issue 27) * fixed bug in gromacs writer (frame.bX = true) * fixed segfault in gromacs writer (issue 54) * added thread class * added spline class, with akima spline, linear spline * random.cc: avoid calling of exit() * added lexical cast class ## Version 1.0.1 (released 01.12.10) * fixed custom md programs in sim scripts (issue 1) * completion file is back from tools * issue #21: fixed strange kink when pot.in was provided * added --disable-rc-files to configure * csg_call/csg_inverse: added installdir as failback for CSGSHARE * fixed a bug in VOTCARC.csh for empty LD_LIBRARY_PATH * completion file has moved back to csg * added --disable-rc-files to configure * updated bundled libtool to 2.2.10 ## Version 1.0 (released 30.09.10) * added postupdate script for scaling the update * imc and csg_stat: no longer require dummy mapping file (--no-map) option * allow comments in tables * fixed bug in pressure correction when p is negative * added support for gromacs devel version * fixed a bug when compiling with gcc-4.4 * fixed a bug that pot.cur was change at every step * added application class for easy implementation of analysis programs * fixed bug if initial potential was given and not used * restart points are no longer deleted after step finished * csg_inverse: preliminary reader for ESPResSo Blockfiles and ESPResSo * preliminary reader for LAMMPS dump files (very limited features) * allow compling without gromacs * a lot new xml optionsfull support for gromacs 4.5 * added libvotca_expat to allow compiling without expat * allow comments in tables * added application class to create standardized applications * all boost dependecy are now in tools * fixes in table format, flags is always last row now * allow compling without fftw (needed for csg_boltzmann only) * allow compling without gsl (needed for csg_resample and csg_fmatch) ## Version 1.0_rc5 (released 16.03.10) * fixed --first-frame option (--first-frame 1 before started at second frame) * fixed compatibility issue when using gromacs development version * updated configure, see --help * added multi_g_density * CSGRC is replaced by VOTCARC of votca_tools * using libexpat instead of libxml2 * added libvotca_boost to allow compiling without boost * using pkg-config to detect package flags * compiles under AIX with xlC * added VOTCARC to initialize all votca parts * updated configure, see --help ## Version 1.0_rc4 (released 08.02.10) * using libtool to build shared libs\\ * fixed a bug in error calculation of multi_g_rdf ## Version 1.0_rc3 (released 29.01.10) * added option --wall-time to csg_inverse if run on a queueing system * added option for IBI to run in parallel * multi_g_rdf, a multiplexed version of g_rdf was added * added some options to csg_call * csg_resample now also calc derivatives * fixed a bug in reading stuff from mpd file * corrected bug in tokenizer * fixed a bug in calculation of version string * some fixes concerning autotools ## Version 1.0_rc2 (released 16.12.09) * added version string to scripts * fixed typo in calculation of version string * added NOTICE and LICENSE to the dist tarball ## Version 1.0_rc1 (released 11.12.09) * initial version csg-1.6_rc1/CMakeLists.txt000066400000000000000000000135301357201131600154420ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.10) project(votca-csg) set(PROJECT_VERSION "1.6_rc1") set(PROJECT_CONTACT "bugs@votca.org") string(REGEX REPLACE "^[1-9]+\\.([1-9]+).*$" "\\1" SOVERSION "${PROJECT_VERSION}") if (NOT ${SOVERSION} MATCHES "[1-9]+") message(FATAL_ERROR "Could not determind SOVERSION from ${PROJECT_VERSION}") endif (NOT ${SOVERSION} MATCHES "[1-9]+") # Cmake modules/macros are in a subdirectory to keep this file cleaner set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) #Release comes with -O3 by default set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) if(CMAKE_BUILD_TYPE STREQUAL Debug) add_definitions(-DDEBUG) endif(CMAKE_BUILD_TYPE STREQUAL Debug) enable_language(CXX) ###################################################################### # compiler tests # these need ot be done early (before further tests). ##################################################################### include(CheckCXXCompilerFlag) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11 ######################################################################## # User input options # ######################################################################## option(BUILD_SHARED_LIBS "Build shared libs" ON) include(GNUInstallDirs) option(ENABLE_TESTING "Build and enable testing stuff" OFF) if(ENABLE_TESTING) enable_testing() endif(ENABLE_TESTING) ######################################################################## #Find external packages ######################################################################## if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.git) find_package(Git) endif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.git) find_package(Threads REQUIRED) option(BUILD_MANPAGES "Build manpages" ON) if (BUILD_MANPAGES) find_package(TXT2TAGS) find_package(UnixCommands) else (BUILD_MANPAGES) #we use TXT2TAGS_FOUND conditionals in other CMakeLists.txt #so that TXT2TAGS is never required set(TXT2TAGS_FOUND) endif (BUILD_MANPAGES) find_package(Boost 1.53.0 REQUIRED COMPONENTS program_options filesystem system ) find_package(Eigen3 3.3.0 NO_MODULE REQUIRED) message(STATUS "Found Eigen3: ${Eigen3_DIR}") find_package(VOTCA_TOOLS NO_MODULE REQUIRED) message(STATUS "Found VOTCA_TOOLS: ${VOTCA_TOOLS_DIR}") if(DEFINED VOTCA_TOOLS_VERSION AND NOT VOTCA_TOOLS_VERSION STREQUAL PROJECT_VERSION) message(FATAL_ERROR "Incompatible VOTCA Tools version found (needed ${PROJECT_VERSION}, found ${VOTCA_TOOLS_VERSION})") endif() option(WITH_GMX "Build gromacs reader/writer, disabling leads to reduced functionality!" ON) if (WITH_GMX) find_package(GROMACS 20160000 REQUIRED) if(DEFINED GROMACS_VERSION AND GROMACS_VERSION VERSION_GREATER_EQUAL "20200000") message(WARNING "Gromacs-2020 and above have no support for tabulated interactions, that are needed for coarse-graining (see and comment on https://redmine.gromacs.org/issues/1347)") endif() endif(WITH_GMX) if(ENABLE_TESTING) set(REGRESSIONTEST_TOLERANCE "5e-5" CACHE STRING "Tolerance for the regression tests") mark_as_advanced(REGRESSIONTEST_TOLERANCE) find_package(UnixCommands) endif(ENABLE_TESTING) ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # ######################################################################## include(CheckIncludeFile) foreach(HEADER assert.h) check_include_file(${HEADER} FOUND_${HEADER}) if(NOT FOUND_${HEADER}) message(FATAL_ERROR "Could not find needed header - ${HEADER}") endif(NOT FOUND_${HEADER}) endforeach(HEADER) include(CheckIncludeFileCXX) foreach(HEADER algorithm fstream iomanip iostream list map numeric sstream stdexcept string vector cstdlib) check_include_file_cxx(${HEADER} FOUND_${HEADER}) if(NOT FOUND_${HEADER}) message(FATAL_ERROR "Could not find needed header - ${HEADER}") endif(NOT FOUND_${HEADER}) endforeach(HEADER) set(MATH_LIBRARIES "m" CACHE STRING "math library") mark_as_advanced( MATH_LIBRARIES ) include(CheckLibraryExists) foreach(FUNC sqrt) check_library_exists(${MATH_LIBRARIES} ${FUNC} "" FOUND_${FUNC}_${MATH_LIBRARIES}) if(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) message(FATAL_ERROR "Could not find needed math function - ${FUNC}") endif(NOT FOUND_${FUNC}_${MATH_LIBRARIES}) endforeach(FUNC) ###################################### # Include the following subdirectory # ###################################### if(NOT TARGET manpages) add_custom_target(manpages ALL) endif() add_subdirectory(src) add_subdirectory(scripts) add_subdirectory(include/votca/csg) add_subdirectory(share) # needs to happen after src and scripts subdir get_property(VOTCA_BINARIES TARGET votca_csg PROPERTY BINARIES) list(SORT VOTCA_BINARIES) configure_file(src/libcsg/VOTCA_CSGConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/src/libcsg/VOTCA_CSGConfig.cmake" @ONLY) # for >=cmake-3.12 use list(JOIN VOTCA_BINARIES " " VOTCA_BINARIES) string(REPLACE ";" " " VOTCA_BINARIES "${VOTCA_BINARIES}") configure_file(scripts/csg-completion.bash.in "${CMAKE_CURRENT_BINARY_DIR}/scripts/csg-completion.bash" @ONLY) configure_file(${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY) add_custom_target(uninstall-csg COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) if(NOT TARGET uninstall) add_custom_target(uninstall) endif() add_dependencies(uninstall uninstall-csg) if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) include(FeatureSummary) feature_summary(INCLUDE_QUIET_PACKAGES WHAT ALL) endif (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) csg-1.6_rc1/CMakeModules/000077500000000000000000000000001357201131600152115ustar00rootroot00000000000000csg-1.6_rc1/CMakeModules/CheckCXXLibraryExists.cmake000066400000000000000000000063561357201131600223520ustar00rootroot00000000000000#.rst: # CheckCXXLibraryExists # ------------------ # # Check if the CXX function exists. # # CHECK_CXX_LIBRARY_EXISTS (LIBRARY FUNCTION LOCATION VARIABLE) # # :: # # LIBRARY - the name of the library you are looking for # FUNCTION - the name of the function # LOCATION - location where the library should be found # VARIABLE - variable to store the result # Will be created as an internal cache variable. # # # # The following variables may be set before calling this macro to modify # the way the check is run: # # :: # # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. # Copyright 2015 The VOTCA Development Team (http://www.votca.org) # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) macro(CHECK_CXX_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) if(NOT DEFINED "${VARIABLE}") set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") if(NOT CMAKE_REQUIRED_QUIET) message(STATUS "Looking for c++ ${FUNCTION} in ${LIBRARY}") endif() set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY}) if(CMAKE_REQUIRED_LIBRARIES) set(CHECK_LIBRARY_EXISTS_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES}) endif() try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/CheckFunctionExists.cpp COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} LINK_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION} -DLINK_DIRECTORIES:STRING=${LOCATION} OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) if(NOT CMAKE_REQUIRED_QUIET) message(STATUS "Looking for c++ ${FUNCTION} in ${LIBRARY} - found") endif() set(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "passed with the following output:\n" "${OUTPUT}\n\n") else() if(NOT CMAKE_REQUIRED_QUIET) message(STATUS "Looking for c++ ${FUNCTION} in ${LIBRARY} - not found") endif() set(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "failed with the following output:\n" "${OUTPUT}\n\n") endif() endif() endmacro() csg-1.6_rc1/CMakeModules/CheckFunctionExists.cpp000066400000000000000000000005741357201131600216460ustar00rootroot00000000000000#ifdef CHECK_FUNCTION_EXISTS char CHECK_FUNCTION_EXISTS(); #ifdef __CLASSIC_C__ int main(){ int ac; char*av[]; #else int main(int ac, char*av[]){ #endif CHECK_FUNCTION_EXISTS(); if(ac > 1000) { return *av[0]; } return 0; } #else /* CHECK_FUNCTION_EXISTS */ # error "CHECK_FUNCTION_EXISTS has to specify the function" #endif /* CHECK_FUNCTION_EXISTS */ csg-1.6_rc1/CMakeModules/FindGROMACS.cmake000066400000000000000000000107451357201131600201160ustar00rootroot00000000000000# - Finds parts of gromacs # Find the native gromacs compents headers and libraries. # # GROMACS_INCLUDE_DIRS - where to find gromacs headers. # GROMACS_LIBRARIES - List of libraries when used by gromacs. # GROMACS_FOUND - True if all gromacs componets were found. # GROMACS_DEFINITIONS - Extra definies needed by gromacs # GROMACS_VERSION - Gromacs lib interface version # # Copyright 2009-2018 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # function(_GROMACS_GET_VERSION _OUT_ver _version_hdr) if(NOT EXISTS ${_version_hdr}) message(FATAL_ERROR "Header file ${_version_hdr} not found (check value of GROMACS_INCLUDE_DIR)") endif() file(STRINGS ${_version_hdr} _contents REGEX "#define GMX_VERSION[ \t]+") if(_contents) string(REGEX REPLACE ".*#define GMX_VERSION[ \t]+([0-9.]+).*" "\\1" ${_OUT_ver} "${_contents}") if(NOT ${${_OUT_ver}}) message(FATAL_ERROR "Version parsing failed for GMX_VERSION in ${_version_hdr}, got empty return!") elseif(NOT ${${_OUT_ver}} MATCHES "^[0-9]+$") message(FATAL_ERROR "Version parsing failed for GMX_VERSION in ${_version_hdr}, excepted a number but got ${${_OUT_ver}}!") endif() set(${_OUT_ver} ${${_OUT_ver}} PARENT_SCOPE) else() message(FATAL_ERROR "No GMX_VERSION line found in include file ${_version_hdr}") endif() endfunction() find_package(PkgConfig) pkg_check_modules(PC_GROMACS_D libgromacs_d) pkg_check_modules(PC_GROMACS libgromacs) find_library(GROMACS_LIBRARY NAMES gromacs_d gromacs HINTS ${PC_GROMACS_D_LIBRARY_DIRS} ${PC_GROMACS_LIBRARY_DIRS}) if (GROMACS_LIBRARY AND NOT GROMACS_LIBRARY STREQUAL "gromacs") include(CheckCXXLibraryExists) check_cxx_library_exists("${GROMACS_LIBRARY}" gmx_version "" FOUND_GROMACS_VERSION_CXX) if(NOT FOUND_GROMACS_VERSION_CXX) message(FATAL_ERROR "Could not find a suitable gromacs library. gmx_version is not defined in the gromacs library, that is very very strange, take a look at the error message in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log to find out what was going wrong. This most likely means that your gromacs version is too old, we need at least gromacs 2016!") endif() check_cxx_library_exists("${GROMACS_LIBRARY}" gmx_is_single_precision "" FOUND_GMX_IS_SINGLE_PRECISION) check_cxx_library_exists("${GROMACS_LIBRARY}" gmx_is_double_precision "" FOUND_GMX_IS_DOUBLE_PRECISION) if(FOUND_GMX_IS_DOUBLE_PRECISION) set(GROMACS_DEFINITIONS "-DGMX_DOUBLE=1") elseif(FOUND_GMX_IS_SINGLE_PRECISION) set(GROMACS_DEFINITIONS "-DGMX_DOUBLE=0") elseif(NOT FOUND_GMX_IS_SINGLE_PRECISION) message(FATAL_ERROR "Could not find a suitable gromacs library. Neither gmx_is_single_precision nor gmx_is_double_precision is defined in the gromacs library, that is very very strange, take a look at the error message in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log to find out what was going wrong. This most likely means that your gromacs version is too old, we need at least gromacs 2016!") endif() endif() find_path(GROMACS_INCLUDE_DIR gromacs/version.h HINTS ${PC_GROMACS_D_INCLUDE_DIRS} ${PC_GROMACS_INCLUDE_DIRS}) if(GROMACS_VERSION) elseif(GROMACS_INCLUDE_DIR) _GROMACS_GET_VERSION(GROMACS_VERSION ${GROMACS_INCLUDE_DIR}/gromacs/version.h) else() set(GROMACS_VERSION 0) endif() set(GROMACS_LIBRARIES "${GROMACS_LIBRARY}" ) set(GROMACS_INCLUDE_DIRS "${GROMACS_INCLUDE_DIR}" ) include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set GROMACS_FOUND to TRUE # if all listed variables are TRUE find_package_handle_standard_args(GROMACS REQUIRED_VARS GROMACS_LIBRARY GROMACS_INCLUDE_DIR VERSION_VAR GROMACS_VERSION) mark_as_advanced(GROMACS_LIBRARY GROMACS_INCLUDE_DIR GROMACS_VERSION) if(GROMACS_FOUND) add_library(GMX::libgromacs UNKNOWN IMPORTED) set_target_properties(GMX::libgromacs PROPERTIES IMPORTED_LOCATION ${GROMACS_LIBRARY} INTERFACE_INCLUDE_DIRECTORIES ${GROMACS_INCLUDE_DIR} INTERFACE_COMPILE_OPTIONS "${GROMACS_DEFINITIONS}") endif() csg-1.6_rc1/CMakeModules/FindTXT2TAGS.cmake000066400000000000000000000040111357201131600202300ustar00rootroot00000000000000# Copyright (C) 2011 Votca Development Team # # This file was derived from FindGnuplot.cmake shipped with CMake 2.6.3. # # - this module looks for txt2tags # # Once done this will define # # TXT2TAGS_FOUND - system has txt2tags # TXT2TAGS_EXECUTABLE - the txt2tags executable # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #============================================================================= # Copyright 2002-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) INCLUDE(FindCygwin) FIND_PROGRAM(TXT2TAGS_EXECUTABLE NAMES txt2tags txt2tags-2.5 txt2tags-2.6 PATHS ${CYGWIN_INSTALL_PATH}/bin ) # handle the QUIETLY and REQUIRED arguments and set TXT2TAGS_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(TXT2TAGS DEFAULT_MSG TXT2TAGS_EXECUTABLE) IF(NOT TXT2TAGS_FOUND) message("txt2tags not found, help cmake to find it by setting TXT2TAGS_EXECUTABLE") ENDIF(NOT TXT2TAGS_FOUND) MARK_AS_ADVANCED( TXT2TAGS_EXECUTABLE ) csg-1.6_rc1/CMakeModules/cmake_uninstall.cmake.in000066400000000000000000000016551357201131600220000ustar00rootroot00000000000000IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) STRING(REGEX REPLACE "\n" ";" files "${files}") FOREACH(file ${files}) MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") IF(EXISTS "$ENV{DESTDIR}${file}") EXEC_PROGRAM( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) IF(NOT "${rm_retval}" STREQUAL 0) MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") ENDIF(NOT "${rm_retval}" STREQUAL 0) ELSE(EXISTS "$ENV{DESTDIR}${file}") MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") ENDIF(EXISTS "$ENV{DESTDIR}${file}") ENDFOREACH(file) csg-1.6_rc1/CMakeModules/gitscript.cmake000066400000000000000000000022211357201131600202200ustar00rootroot00000000000000if (GIT_EXECUTABLE) # refresh git index execute_process(COMMAND ${GIT_EXECUTABLE} update-index -q --refresh WORKING_DIRECTORY ${TOP_SOURCE_DIR} TIMEOUT 5 OUTPUT_QUIET ERROR_VARIABLE EXEC_ERR OUTPUT_STRIP_TRAILING_WHITESPACE ) #later use git describe here execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD WORKING_DIRECTORY ${TOP_SOURCE_DIR} OUTPUT_VARIABLE THIS_GIT_ID OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process( COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD WORKING_DIRECTORY ${TOP_SOURCE_DIR} OUTPUT_VARIABLE _HAS_CHANGES OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) if (NOT "${_HAS_CHANGES}" STREQUAL "") set(THIS_GIT_ID "${THIS_GIT_ID} (dirty)") endif() message("Current git revision is ${THIS_GIT_ID}") set(THIS_GIT_ID "gitid: ${THIS_GIT_ID}") else() set (THIS_GIT_ID) endif() file(READ ${INPUT} CONTENT) string(REGEX REPLACE "#CSG_GIT_ID#" "${THIS_GIT_ID}" NEW_CONTENT "${CONTENT}") file(WRITE "${OUTPUT}.tmp" "${NEW_CONTENT}") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${OUTPUT}.tmp ${OUTPUT}) execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${OUTPUT}.tmp) csg-1.6_rc1/CMakeModules/gitversion.cmake000066400000000000000000000022521357201131600204050ustar00rootroot00000000000000if (GIT_EXECUTABLE) # refresh git index execute_process(COMMAND ${GIT_EXECUTABLE} update-index -q --refresh WORKING_DIRECTORY ${TOP_SOURCE_DIR} TIMEOUT 5 OUTPUT_QUIET ERROR_VARIABLE EXEC_ERR OUTPUT_STRIP_TRAILING_WHITESPACE ) #later use git describe here execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD WORKING_DIRECTORY ${TOP_SOURCE_DIR} OUTPUT_VARIABLE THIS_GIT_ID OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process( COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD WORKING_DIRECTORY ${TOP_SOURCE_DIR} OUTPUT_VARIABLE _HAS_CHANGES OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) if (NOT "${_HAS_CHANGES}" STREQUAL "") set(THIS_GIT_ID "${THIS_GIT_ID} (dirty)") endif() message("Current git revision is ${THIS_GIT_ID}") set(THIS_GIT_ID "gitid: ${THIS_GIT_ID}") else() set (THIS_GIT_ID) endif() set (GIT_HEADER "gitversion.h") set (NEW_GIT_HEADER "new_gitversion.h") file(WRITE ${NEW_GIT_HEADER} "static const std::string gitversion = \"${THIS_GIT_ID}\";\n") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NEW_GIT_HEADER} ${GIT_HEADER}) execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${NEW_GIT_HEADER}) csg-1.6_rc1/LICENSE000066400000000000000000000261361357201131600137150ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. csg-1.6_rc1/NOTICE000066400000000000000000000007321357201131600136060ustar00rootroot00000000000000Versatile Object-oriented Toolkit for Coarse-graining Applications Copyright 2009-2011 The VOTCA Development Team This product includes software developed at The VOTCA Development Team (http://www.votca.org). This software contains code, in particular function_common.sh, derived from a script collection by C. Junghans. Thanks to Nikolaus Hansen (hansen@lri.fr, @nikohansen on github) for providing the bundled version of cma.py, which is licensed under BSD 3-Clause. csg-1.6_rc1/README.md000066400000000000000000000034611357201131600141630ustar00rootroot00000000000000[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2fff2f588e7e40bd93292016052e6224)](https://www.codacy.com/manual/votca-package/csg?utm_source=github.com&utm_medium=referral&utm_content=votca/csg&utm_campaign=Badge_Grade) [![codecov](https://codecov.io/gh/votca/csg/branch/master/graph/badge.svg)](https://codecov.io/gh/votca/csg) [![Build Status](https://travis-ci.org/votca/csg.svg?branch=master)](https://travis-ci.org/votca/csg) [![pipeline status](https://gitlab.com/votca/csg/badges/master/pipeline.svg)](https://gitlab.com/votca/csg/commits/master) VOTCA-CSG is a collection of tools, which help you to develop coarse grained interaction potential from atomistic reference simulations using force-matching, boltzmann inversion and others. Further information on VOTCA can be found at The development of VOTCA is mainly funded by academic research grants. If you use this package, please cite the following VOTCA papers: * _Relative entropy and optimization-driven coarse-graining methods in VOTCA_, S.Y. Mashayak, M. Jochum, K. Koschke, N.R. Aluru, V. Ruehle, and C. Junghans, [PLoS one 10, e131754 (2015)](http://dx.doi.org/10.1371/journal.pone.0131754). * _Hybrid approaches to coarse-graining using the VOTCA package: liquid hexane_, V. Ruehle and C. Junghans, [Macromol. Theory Simul. 20, 472 (2011)](http://dx.doi.org/10.1002/mats.201100011). * _Versatile Object-oriented Toolkit for Coarse-graining Applications_, V.Ruehle, C. Junghans, A. Lukyanov, K. Kremer, and D. Andrienko, [J. Chem. Theo. Comp. 5 (12), 3211 (2009)](http://dx.doi.org/10.1021/ct900369w). In case of questions, please post them in the google discussion group for votca at: You can contact the VOTCA Development Team at devs@votca.org. csg-1.6_rc1/include/000077500000000000000000000000001357201131600143235ustar00rootroot00000000000000csg-1.6_rc1/include/votca/000077500000000000000000000000001357201131600154375ustar00rootroot00000000000000csg-1.6_rc1/include/votca/csg/000077500000000000000000000000001357201131600162135ustar00rootroot00000000000000csg-1.6_rc1/include/votca/csg/CMakeLists.txt000066400000000000000000000002161357201131600207520ustar00rootroot00000000000000file(GLOB_RECURSE VOTCA_HEADERS *.h potentialfunctions/*.h) install(FILES ${VOTCA_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/votca/csg) csg-1.6_rc1/include/votca/csg/basebead.h000066400000000000000000000100131357201131600201050ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_BASEBEAD_H #define _VOTCA_CSG_BASEBEAD_H #include #include #include #include #include #include #include #include namespace TOOLS = votca::tools; namespace votca { namespace csg { /** * \brief information about a base bead * * The Base Bead class describes the core functionality of an atom or a coarse * grained bead. It stores information like the id, the name, the mass, the * charge and the residue it belongs to and the position * **/ class BaseBead { public: /** * destructor */ virtual ~BaseBead() = default; /// Gets the id of the bead Index getId() const { return id_.getId(); } /// Sets the id of the bead void setId(Index id) { id_.setId(id); } /// Gets the name of the bead std::string getName() const { return name_.getName(); } /// Sets the name of the bead void setName(std::string name) { return name_.setName(name); } /// Sets the molecule the bead is attached too void setMolecule(Molecule *molecule) { molecule_item_.setMolecule(molecule); } /// Gets the molecule pointer the bead is attached too Molecule *getMolecule() const { return molecule_item_.getMolecule(); } /// Gets the topology pointer the bead is attached too Topology *getParent() const { return topology_item_.getParent(); } /** * get the bead type * \return const string */ virtual const std::string getType() const { return type_.getName(); } /** * set the bead type * \param bead type object */ virtual void setType(std::string type) { type_.setName(type); } /** * get the mass of the base bead * \return - base bead mass */ virtual const double &getMass() const { return mass_; } /** * set the mass of the base bead * \param - base bead mass */ virtual void setMass(const double &m) { mass_ = m; } /** * set the position of the base bead * \param - base bead position */ virtual void setPos(const Eigen::Vector3d &bead_position); /** * get the position of the base bead * \return base bead position */ virtual const Eigen::Vector3d &getPos() const; /** * direct access (read/write) to the position of the base bead * \return reference to position */ virtual Eigen::Vector3d &Pos() { assert(bead_position_set_ && "Position is not set."); return bead_position_; } /** does this configuration store positions? */ bool HasPos() const { return bead_position_set_; } /** set has position to true */ void HasPos(bool true_or_false) { bead_position_set_ = true_or_false; } protected: BaseBead() : topology_item_(nullptr), molecule_item_(nullptr), mass_(0.0), bead_position_set_(false){}; TopologyItem topology_item_; MoleculeItem molecule_item_; TOOLS::Identity id_; TOOLS::Name name_; TOOLS::Name type_; double mass_; Eigen::Vector3d bead_position_; bool bead_position_set_; }; inline void BaseBead::setPos(const Eigen::Vector3d &bead_position) { bead_position_set_ = true; bead_position_ = bead_position; } inline const Eigen::Vector3d &BaseBead::getPos() const { assert(bead_position_set_ && "Cannot get bead position as it has not been set."); return bead_position_; } } // namespace csg } // namespace votca #endif // _VOTCA_CSG_BASEBEAD_H csg-1.6_rc1/include/votca/csg/bead.h000066400000000000000000000222721357201131600172640ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_BEAD_H #define _VOTCA_CSG_BEAD_H #include #include #include #include #include #include "basebead.h" namespace votca { namespace csg { class Topology; class Molecule; /** * \brief information about a bead * * The Bead class describes an atom or a coarse grained bead. It stores * information like the id, the name, the mass, the * charge and the residue it belongs to. The coordinates are stored in the * configuration class. * * \todo change resnr to pointer * \todo make sure bead belongs to topology **/ class Bead : public BaseBead { public: /** * destructor */ ~Bead() override = default; /** * get the residu number of the bead * \return residue id */ const Index &getResnr() const { return residue_number_; } /** * get the charge of the bead * \return - base bead charge */ virtual const double &getQ() const { return charge_; } /** * set the charge of the base bead * \param[in] - base bead position */ virtual void setQ(const double &q) { charge_ = q; } /** * \brief get the symmetry of the bead * * Returns the number of unique axis of the bead, it can be * 1 for a spherical bead * 3 for an ellipsoidal bead * 2 (currently not used), could be disk like particle * * \return bead symmetry */ enum Symmetry { spherical = 1, ellipsoidal = 3 }; Symmetry getSymmetry() const { return symmetry_; } /** * set the velocity of the bead * @param r bead velocity */ void setVel(const Eigen::Vector3d &r); /** * get the velocity of the bead * \return bead velocity */ const Eigen::Vector3d &getVel() const; /** * \brief set first orientation (normal vector) vector of bead * * see getU for details * * @param u bead orientation u */ void setU(const Eigen::Vector3d &u); /** * \brief get first orientation (normal vector) vector of bead * * Non-spherical beads (symmetry 3) have a internal coordinates system and the * axes are denoted as u, v and w. Currently the non-spherical mapping is * hardcoded and * the axis u is calculated by the eigenvector with the lowest eigenvector of * the mapped beads and has the meaning of a normal vector if the reference * beads * have a disc like shape. The sign of the normal vector is determined in * combination * with the vectors v and w to build up a right handed (??) coordinate system. * * \return bead orientation u */ const Eigen::Vector3d &getU() const; /** * \brief set second orientation vector of bead * * see getV for details * * @param v bead orientation v */ void setV(const Eigen::Vector3d &v); /** * \brief get second orientation vector of bead * * Non-spherical beads (symmetry 3) have a internal coordinates system and the * axes are denoted as u, v and w. Currently the non-spherical mapping is * hardcoded and * the axis v is the vector which connects first and second reference atom * in the mapping (only orthogonal component to u). * * \return bead orientation u */ const Eigen::Vector3d &getV() const; /** * \brief set third orientation vector of bead * * see getW for details * * @param w bead orientation w */ void setW(const Eigen::Vector3d &w); /** * \brief get third orientation vector of bead * * Non-spherical beads (symmetry 3) have a internal coordinates system and the * axes are denoted as u, v and w. Currently the non-spherical mapping is * hardcoded and * the axis w is orthogonal to u and v. * * \return bead orientation w */ const Eigen::Vector3d &getW() const; /** * direct access (read/write) to the velocity of the bead * \return reference to velocity */ Eigen::Vector3d &Vel() { assert(bead_velocity_set_ && "Cannot access velocity, it has not been set."); return velocity_; } /** * direct access (read/write) to orientation u of the bead * \return reference to u */ Eigen::Vector3d &U() { assert(bU_ && "Cannot access bead orientation u, has not been set."); return u_; } /** * direct access (read/write) to the orientation v of the bead * \return reference to v */ Eigen::Vector3d &V() { assert(bV_ && "Cannot access bead orientation v, has not been set."); return v_; } /** * direct access (read/write) to the orientation w of the bead * \return reference to w */ Eigen::Vector3d &W() { assert(bW_ && "Cannot access bead orientation w, has not been set."); return w_; } /** * direct access (read/write) to the force of the bead * \return reference to force */ Eigen::Vector3d &F() { assert(bead_force_set_ && "Cannot access bead force, has not been set."); return bead_force_; } /** * set force acting on bead * @param bead_force force */ void setF(const Eigen::Vector3d &bead_force); /** * \brief get the force acting on the bead * * Forces have to be provided by the trajectory. If beads are mapped, forces * of coarse-grained beads are also calculated. * * \return force on bead */ const Eigen::Vector3d &getF() const; /** does this configuration store velocities? */ bool HasVel() { return bead_velocity_set_; } /** does this configuration store forces? */ bool HasF() { return bead_force_set_; } /** does this configuration store u-orientations? */ bool HasU() { return bU_; } /** does this configuration store v-orientations? */ bool HasV() { return bV_; } /** does this configuration store w-orientations? */ bool HasW() { return bW_; } /** dos the bead store a velocity */ void HasVel(bool b); /** dos the bead store a force */ void HasF(bool b); /** doe the bead store an orientation u */ void HasU(bool b); /** doe the bead store an orientation v */ void HasV(bool b); /** doe the bead store an orientation w */ void HasW(bool b); /** * If it is a mapped beads, returns te bead id the cg bead was created from * \return vector of bead ids of reference atoms */ const std::vector &ParentBeads() { return parent_beads_; }; /** * \brief Clears out all parent beads **/ void ClearParentBeads() { parent_beads_.clear(); } /** * \brief Adds the id of a parent bead **/ void AddParentBead(Index parent_bead_id) { parent_beads_.push_back(parent_bead_id); } protected: std::vector parent_beads_; Symmetry symmetry_; double charge_; Index residue_number_; Eigen::Vector3d velocity_, bead_force_, u_, v_, w_; bool bead_velocity_set_; bool bU_; bool bV_; bool bW_; bool bead_force_set_; /// constructor Bead(Topology *owner, Index id, std::string type, Symmetry symmetry, std::string name, Index resnr, double m, double q) : symmetry_(symmetry), charge_(q), residue_number_(resnr) { topology_item_._parent = owner; setId(id); setType(type); setName(name); setMass(m); bead_position_set_ = false; bead_velocity_set_ = false; bU_ = false; bV_ = false; bW_ = false; bead_force_set_ = false; } friend class Topology; friend class Molecule; }; inline void Bead::setVel(const Eigen::Vector3d &r) { bead_velocity_set_ = true; velocity_ = r; } inline const Eigen::Vector3d &Bead::getVel() const { assert(bead_velocity_set_ && "Cannot access bead velocity, has not been set."); return velocity_; } inline void Bead::setU(const Eigen::Vector3d &u) { bU_ = true; u_ = u; } inline const Eigen::Vector3d &Bead::getU() const { assert(bU_ && "Cannot access bead orientation u, has not been set."); return u_; } inline void Bead::setV(const Eigen::Vector3d &v) { bV_ = true; v_ = v; } inline const Eigen::Vector3d &Bead::getV() const { assert(bV_); return v_; } inline void Bead::setW(const Eigen::Vector3d &w) { bW_ = true; w_ = w; } inline const Eigen::Vector3d &Bead::getW() const { assert(bW_ && "Cannot access bead orientation w, has not been set."); return w_; } inline void Bead::setF(const Eigen::Vector3d &bead_force) { bead_force_set_ = true; bead_force_ = bead_force; } inline const Eigen::Vector3d &Bead::getF() const { assert(bead_force_set_ && "Cannot access bead force, has not been set."); return bead_force_; } inline void Bead::HasVel(bool b) { bead_velocity_set_ = b; } inline void Bead::HasF(bool b) { bead_force_set_ = b; } inline void Bead::HasU(bool b) { bU_ = b; } inline void Bead::HasV(bool b) { bV_ = b; } inline void Bead::HasW(bool b) { bW_ = b; } } // namespace csg } // namespace votca #endif // _VOTCA_CSG_BEAD_H csg-1.6_rc1/include/votca/csg/beadlist.h000066400000000000000000000035471357201131600201640ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_BEADLIST_H #define _VOTCA_CSG_BEADLIST_H #include #include #include #include namespace votca { namespace csg { /** \brief Generate lists of beads This class generates a list of beads based on some criteria, currently only the bead type. */ class Topology; class Bead; class BeadList { public: /// \brief Select all beads of type withn a radius of /// reference vector Index GenerateInSphericalSubvolume(Topology &top, const std::string &select, Eigen::Vector3d ref, double radius); Index size() const { return _beads.size(); } bool empty() const { return _beads.empty(); } void push_back(Bead *bead) { _beads.push_back(bead); } using iterator = typename std::vector::iterator; iterator begin() { return _beads.begin(); } iterator end() { return _beads.end(); } Topology *getTopology() { return _topology; } private: std::vector _beads; Topology *_topology; }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_BEADLIST_H */ csg-1.6_rc1/include/votca/csg/beadmotif.h000066400000000000000000000117161357201131600203240ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef VOTCA_CSG_BEADMOTIF_H #define VOTCA_CSG_BEADMOTIF_H #include "beadstructure.h" #include #include namespace TOOLS = votca::tools; namespace votca { namespace csg { /** * \brief Designed determine what kind of structure a beadstructure has * * Wants a beadstructure is created there are several different forms it can * have, this class helps to classify and break structures up into the * appropriate sub class. The possible classes include: * * Some of the structures are considered fundamental and cannot be broken up any * more than they are. These elements are listed as simple * * 1. Single bead // Simple * 2. Line // Simple * 3. Loop // Simple * 4. Fused Ring // Simple * 5. Single Structure // Complex * 6. Multiple Structures // Complex * 6. Undefined // Undefined * * Examples of each type are shown below connections are indicated with lines * * Single Bead: * * H1 * * Line: * * C1 - C2 - C3 H1 - H2 H1 H2 * \ / * O1 * Loop: * * C1 - C2 C5 - C6 * | | / \ * C4 - C3 C7 C8 * \ / * C9 - C10 * * Fused Ring: * * C5 - C6 * / \ * C7 C8 - C11 * \ / \ * C9 - C10 C12 * \ / * C13 - C14 * * Single Structures: * * H1 H5 H6 * | \ / * H2 - C1 - H3 C1 - C2 * | / \ * H4 H7 - C3 C4 - H8 * \ / * C5 - C6 * / \ * H9 H10 * * Multiple Structures: * * Any combination of more than one structure * * The Single, line, loop and Fused Ring types are all elementary types that * represent a fundamental structural unit. * * Single Structure represents a type that has not been broken up into its * fundamental components but consists of a single interconnected structure. * * Multiple Structures means that the structure consists of multiple * structures * * Undefined means the structure has not yet been categorized. * * Though the Beadmotif inherits from the Beadstructure its methods are kept * private the reason is that the type might be incorrect if an AddBead * from the original class is called. **/ class BeadMotif : public BeadStructure { public: enum MotifType { empty, single_bead, line, loop, fused_ring, single_structure, multiple_structures, undefined }; BeadMotif() = default; BeadMotif(const BeadStructure &structure) : BeadStructure(structure){}; /// Gets the motif type, calculates it first if it is not yet known MotifType getType(); /** * \brief Determines if the motif type is a simple type * * If the motif is of type single_bead, line, loop or fused ring it will * return true. * * @return true if the bead motif type is simple **/ bool isMotifSimple(); /** * \brief Adds a new bead to the motif * * This method calls the beastructure AddBead method but it also switches an * attribute indicating that the beadtype is now out of date. * * @param[in] basebead pointer **/ void AddBead(BaseBead *basebead); /** * \brief Adds a new connection to the motif * * Also switches an internal attribute to indicate the beadtype is no longer * up to date. * * \param[in] - id of the first and second beads that are connected **/ void ConnectBeads(Index bead1_id, Index bead2_id); private: MotifType type_ = MotifType::undefined; bool junctionsUpToDate_ = false; bool type_up_to_date_ = false; std::vector junctions_; TOOLS::ReducedGraph reduced_graph_; void InitializeGraph_(); bool junctionExist_(); void CalculateType_(); bool isSingle_(); bool isLine_(); bool isLoop_(); bool isFusedRing_(); }; } // namespace csg } // namespace votca #endif // VOTCA_CSG_BEADMOTIF_H csg-1.6_rc1/include/votca/csg/beadmotifalgorithms.h000066400000000000000000000046271357201131600224210ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef VOTCA_CSG_BEADMOTIFALGORITHMS_H #define VOTCA_CSG_BEADMOTIFALGORITHMS_H #include "beadmotif.h" #include "beadmotifconnector.h" #include "beadstructure.h" #include "beadstructurealgorithms.h" namespace votca { namespace csg { /** * \brief breaks a beadstructure into individual motifs. * * Will essentially take structures that are indenpendent of each other and * break them into separate beadmotifs. * * @param[in] - reference to beadstructure * @return - a container of beadmotifs **/ template T breakIntoMotifs(BeadStructure &beadstructure) { T bead_motifs; std::vector> structures = breakIntoStructures(beadstructure); for (BeadStructure &structure : structures) { bead_motifs.push_back(BeadMotif(structure)); } return bead_motifs; } /** * \brief This function will take a beadmotif and break it into its simple *motifs. * * A simple motif is one of four types: * single_bead * line * loop * fused_ring * * So given a beadmotif like this: * * H1 H1 * | * C1 => C1 * / \ * H2 H3 H2 H3 * * This structure which is originally of type 'single_structure' will be broken * up into 4 singles of type 'single_bead' * * Something like this: * * C1 - C2 C1 - C2 * | | => | | * C3 - C4 - C5 - H1 C3 - C4 C5 - H1 * * This structure is of type 'single_structure' will be broken up into two * separate structures 1 of type 'loop' and the other of type line. **/ std::pair, BeadMotifConnector> breakIntoSimpleMotifs(BeadMotif beadmotif); } // namespace csg } // namespace votca #endif // VOTCA_CSG_BEADMOTIFALGORITHMS_H csg-1.6_rc1/include/votca/csg/beadmotifconnector.h000066400000000000000000000045341357201131600222370ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_BEADMOTIFCONNECTOR_H #define _VOTCA_CSG_BEADMOTIFCONNECTOR_H #include #include #include #include #include #include namespace TOOLS = votca::tools; namespace votca { namespace csg { typedef boost::bimap, boost::bimaps::set_of> boost_bimap; /** * \brief Simple class for storing the connections between motifs and the * underlying beads that are part of the connection. * * A graph like this * * 1 - 2 - 3 - 4 * | | * 5 - 6 * * Will be broken up into two motifs a line motif and a loop motif the * BeadMotifConnector tracks the connections between the now independ motifs * * Motif 0 Motif 1 * * 1 - 2 3 - 4 * | | * 5 - 6 * * The motif connection is stored as edge: 0 - 1 * The corresbonding bead connection as edge: 2 - 3 * **/ class BeadMotifConnector { public: void AddMotifAndBeadEdge(TOOLS::Edge motif_edge, TOOLS::Edge bead_edge); /// Returns the bead edges connecting the motifs specified by motif_edge std::vector getBeadEdges(TOOLS::Edge motif_edge); /// Returns all the bead edges connecting the motifs std::vector getBeadEdges(); /// Returns the motifs involved between two beads given by bead_edge TOOLS::Edge getMotifEdge(TOOLS::Edge bead_edge); /// Returns all the motif edges std::unordered_set getMotifEdges(); private: boost_bimap motif_and_bead_edges_; }; } // namespace csg } // namespace votca #endif // _VOTCA_CSG_BEADMOTIFCONNECTOR_H csg-1.6_rc1/include/votca/csg/beadpair.h000066400000000000000000000030411357201131600201310ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_BEADPAIR_H #define _VOTCA_CSG_BEADPAIR_H #include namespace votca { namespace csg { /** \brief A particle pair This class defines a particle pair. The future plan is, that the Pair class can be overloaded and Particle list creates these inherited pairs. */ class BeadPair { public: BeadPair() = default; BeadPair(Bead *bead1, Bead *bead2, Eigen::Vector3d r) : _pair(std::pair(bead1, bead2)), _r(r), _dist(r.norm()) {} Bead *first() { return _pair.first; } Bead *second() { return _pair.second; } /// \brief the vector connecting two beads Eigen::Vector3d &r() { return _r; } /// \brief the distance of the beads double &dist() { return _dist; } protected: std::pair _pair; Eigen::Vector3d _r; double _dist; }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_BEADPAIR_H */ csg-1.6_rc1/include/votca/csg/beadstructure.h000066400000000000000000000200461357201131600212420ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_BEADSTRUCTURE_H #define _VOTCA_CSG_BEADSTRUCTURE_H #include #include #include #include #include #include namespace TOOLS = votca::tools; namespace votca { namespace csg { /** * \brief Designed to determine if the structure beads passed in * * Essentially it will have the functionality to determine if the stored beads * make up a single molecule. It can also break the stored beads up into * molecules. It can compare two bead structures and determine if they are the * same structure. The Ids of a bead will not determine if a structure is * equivalent or not. Each bead must have a unique Id. * * E.g. If a beadstructure is composed of the following: * * BeadStructure 1 * Name:"A" Id:1 ---- Name:"B" Id:2 * * BeadStucture 2 * Name:"A" Id:3 ---- Name:"B" Id:4 * * Here BeadStructure 1 and 2 will compare equal * **/ template class BeadStructure { public: ~BeadStructure() = default; /** * \brief Determine if the bead structure consists of a single connected * structure * * This function will determine if all beads in the structure are connected * somehow to everyother bead. The connection does not have to be direct * * @return - returns a boolean true if it is a single Structure **/ bool isSingleStructure(); /** * \brief returns the number of beads in the bead structure **/ size_t BeadCount() { return beads_.size(); } /** * \brief add a bead to the bead structure * * The same bead cannot be added twice. **/ void AddBead(T *bead); /** * \brief Get the bead with the specified id **/ T *getBead(Index id); /** * \brief Create a connection between two beads in the structure * * A bead cannot be connected to itself. It also may not be connected to a * bead that has not yet been added to the structure. **/ void ConnectBeads(Index bead1_id, Index bead2_id); /** * \brief Return a vector of all the beads neighboring the index **/ std::vector getNeighBeads(Index index); TOOLS::Graph getGraph(); /** * \brief Compare the topology of two bead structures * * This function looks at how the beads are arranged within the bead structure * and determines if the topology is the same. * * @param[in] - beadstructure to compare with * @return - if the same returns true else false * **/ bool isStructureEquivalent(BeadStructure &beadstructure); bool BeadExist(Index bead_id) const { return beads_.count(bead_id); } protected: void InitializeGraph_(); void CalculateStructure_(); TOOLS::GraphNode BaseBeadToGraphNode_(T *basebead); bool structureIdUpToDate = false; bool graphUpToDate = false; bool single_structureUpToDate_ = false; bool single_structure_ = false; std::string structure_id_ = ""; TOOLS::Graph graph_; std::set connections_; std::unordered_map beads_; std::unordered_map graphnodes_; }; /********************** * Internal Functions * **********************/ template void BeadStructure::InitializeGraph_() { if (!graphUpToDate) { std::vector connections_vector; for (const TOOLS::Edge &edge : connections_) { connections_vector.push_back(edge); } for (std::pair &id_bead_ptr_pair : beads_) { graphnodes_[id_bead_ptr_pair.first] = BaseBeadToGraphNode_(id_bead_ptr_pair.second); } graph_ = TOOLS::Graph(connections_vector, graphnodes_); graphUpToDate = true; } } template void BeadStructure::CalculateStructure_() { InitializeGraph_(); if (!structureIdUpToDate) { structure_id_ = TOOLS::findStructureId(graph_); structureIdUpToDate = true; } } template TOOLS::GraphNode BeadStructure::BaseBeadToGraphNode_(T *basebead) { std::unordered_map attributes1; std::unordered_map attributes2; attributes1["Mass"] = basebead->getMass(); attributes2["Name"] = basebead->getName(); /// Add graphnodes TOOLS::GraphNode graphnode; graphnode.setDouble(attributes1); graphnode.setStr(attributes2); return graphnode; } /*************************** * Public Facing Functions * ***************************/ template void BeadStructure::AddBead(T *bead) { if (beads_.count(bead->getId())) { std::string err = "Cannot add bead with Id "; err += std::to_string(bead->getId()); err += " because each bead must have a unique Id and a bead with that Id "; err += "already exists within the beadstructure"; throw std::invalid_argument(err); } size_t numberOfBeads = beads_.size(); beads_[bead->getId()] = bead; if (numberOfBeads != beads_.size()) { single_structureUpToDate_ = false; graphUpToDate = false; structureIdUpToDate = false; } } template void BeadStructure::ConnectBeads(Index bead1_id, Index bead2_id) { if (!(beads_.count(bead1_id)) || !(beads_.count(bead2_id))) { std::string err = "Cannot connect beads in bead structure that do not exist"; throw std::invalid_argument(err); } if (bead1_id == bead2_id) { std::string err = "Beads cannot be self-connected"; throw std::invalid_argument(err); } size_t numberOfConnections = connections_.size(); connections_.insert(TOOLS::Edge(bead1_id, bead2_id)); if (numberOfConnections != connections_.size()) { single_structureUpToDate_ = false; graphUpToDate = false; structureIdUpToDate = false; } } template TOOLS::Graph BeadStructure::getGraph() { InitializeGraph_(); return graph_; } template bool BeadStructure::isSingleStructure() { InitializeGraph_(); if (single_structureUpToDate_ == false) { std::vector vertices = graph_.getVertices(); if (vertices.size() == 0) { single_structure_ = false; return single_structure_; } // Choose first vertex that is actually in the graph as the starting vertex TOOLS::Graph_BF_Visitor gv_breadth_first; gv_breadth_first.setStartingVertex(vertices.at(0)); if (!singleNetwork(graph_, gv_breadth_first)) { single_structure_ = false; return single_structure_; } if (beads_.size() == 0) { single_structure_ = false; return single_structure_; } if (vertices.size() != beads_.size()) { single_structure_ = false; return single_structure_; } single_structure_ = true; single_structureUpToDate_ = true; } return single_structure_; } template bool BeadStructure::isStructureEquivalent(BeadStructure &beadstructure) { if (!structureIdUpToDate) { CalculateStructure_(); } if (!beadstructure.structureIdUpToDate) { beadstructure.CalculateStructure_(); } return structure_id_.compare(beadstructure.structure_id_) == 0; } template std::vector BeadStructure::getNeighBeads(Index index) { if (!graphUpToDate) { InitializeGraph_(); } std::vector neighbor_ids = graph_.getNeighVertices(index); std::vector neighbeads; for (Index &node_id : neighbor_ids) { neighbeads.push_back(beads_[node_id]); } return neighbeads; } template T *BeadStructure::getBead(Index index) { assert(beads_.count(index)); return beads_[index]; } } // namespace csg } // namespace votca #endif csg-1.6_rc1/include/votca/csg/beadstructurealgorithms.h000066400000000000000000000017611357201131600233370ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef VOTCA_CSG_BEADSTRUCTUREALGORITHMS_H #define VOTCA_CSG_BEADSTRUCTUREALGORITHMS_H #include "basebead.h" #include "beadstructure.h" namespace votca { namespace csg { std::vector> breakIntoStructures( BeadStructure& beadstructure); } // namespace csg } // namespace votca #endif // VOTCA_CSG_BEADSTRUCTUREALGORITHMS_H csg-1.6_rc1/include/votca/csg/beadtriple.h000066400000000000000000000037421357201131600205050ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_BEADTRIPLE_H #define _VOTCA_CSG_BEADTRIPLE_H #include namespace votca { namespace csg { /** \brief A triplet of tree Beads */ class BeadTriple : public std::tuple { public: BeadTriple() = default; BeadTriple(Bead *bead1, Bead *bead2, Bead *bead3, Eigen::Vector3d r12, Eigen::Vector3d r13, Eigen::Vector3d r23) : std::tuple(bead1, bead2, bead3), _r12(r12), _r13(r13), _r23(r23), _dist12(r12.norm()), _dist13(r13.norm()), _dist23(r23.norm()) {} virtual ~BeadTriple() = default; /// \brief return the beads const Bead *bead1() { return std::get<0>(*this); } const Bead *bead2() { return std::get<1>(*this); } const Bead *bead3() { return std::get<2>(*this); } /// \brief the vector connecting two beads Eigen::Vector3d &r12() { return _r12; } Eigen::Vector3d &r13() { return _r13; } Eigen::Vector3d &r23() { return _r23; } /// \brief the distance of the beads double &dist12() { return _dist12; } double &dist13() { return _dist13; } double &dist23() { return _dist23; } protected: Eigen::Vector3d _r12; Eigen::Vector3d _r13; Eigen::Vector3d _r23; double _dist12; double _dist13; double _dist23; }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_BEADTRIPLE_H */ csg-1.6_rc1/include/votca/csg/beadtype.h000066400000000000000000000026011357201131600201600ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_BEADTYPE_H #define _VOTCA_CSG_BEADTYPE_H #include "topologyitem.h" #include namespace votca { namespace csg { /** \brief Bead Type informaton Each bead has a type. While the bead name should be unique, several beads can share the same type. */ class BeadType : public TopologyItem { public: const Index &getId() const { return _id; } const std::string &getName() const { return _name; } void setName(const std::string &name) { _name = name; } private: Index _id; std::string _name; BeadType(Topology *parent, Index id, const std::string &name) : TopologyItem(parent), _id(id), _name(name) {} friend class Topology; }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_BEADTYPE_H */ csg-1.6_rc1/include/votca/csg/boundarycondition.h000066400000000000000000000033201357201131600221140ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_BOUNDARYCONDITION_H #define _VOTCA_CSG_BOUNDARYCONDITION_H #include namespace votca { namespace csg { class BoundaryCondition { public: virtual ~BoundaryCondition() = default; /** * set the simulation box * \param box triclinic box matrix */ void setBox(const Eigen::Matrix3d &box) { _box = box; }; /** * get the simulation box * \return triclinic box matrix */ const Eigen::Matrix3d &getBox() { return _box; }; /** * get the volume of the box * \return box volume as double */ virtual double BoxVolume(); /** * get shortest connection vector between r_i and r_j with respect to the * (periodic) box \return shortest distance vector */ virtual Eigen::Vector3d BCShortestConnection( const Eigen::Vector3d &r_i, const Eigen::Vector3d &r_j) const = 0; enum eBoxtype { typeAuto = 0, typeTriclinic, typeOrthorhombic, typeOpen }; virtual eBoxtype getBoxType() = 0; protected: Eigen::Matrix3d _box; }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_BOUNDARYCONDITION_H */ csg-1.6_rc1/include/votca/csg/cgengine.h000066400000000000000000000054461357201131600201540ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_CGENGINE_H #define _VOTCA_CSG_CGENGINE_H #include "cgmoleculedef.h" #include "cgobserver.h" #include "topology.h" #include "topologymap.h" #include #include #include #include #include "cgengine.h" #include "cgmoleculedef.h" #include "molecule.h" #include "nematicorder.h" #include "topologyreader.h" #include "trajectoryreader.h" #include "trajectorywriter.h" #include namespace votca { namespace csg { /** \brief coarse graining engine This class manages the coarse graining, at the moment it does the measurement stuff TODO: split this into an additional VotcaApplication object */ class CGEngine { public: CGEngine(); ~CGEngine(); /** create a coarse grained topolgy based on a given topology */ TopologyMap *CreateCGTopology(Topology &in, Topology &out); /** load molecule type from file */ void LoadMoleculeType(std::string filename); CGMoleculeDef *getMoleculeDef(std::string name); /** * \brief ignores molecule in mapping process * \param pattern glob pattern for molecule ident */ void AddIgnore(std::string pattern) { _ignores.push_back(pattern); } /** * \brief checks whether molecule is ignored * \param ident identifyier of molecule * \return true if is ignored */ bool IsIgnored(std::string ident); private: std::map _molecule_defs; std::list _ignores; }; inline CGMoleculeDef *CGEngine::getMoleculeDef(std::string name) { std::map::iterator iter; // if there is only 1 molecule definition, don't care about the name if (_molecule_defs.size() == 1 && name == "unnamed") { return (*(_molecule_defs.begin())).second; } iter = _molecule_defs.find(name); if (iter == _molecule_defs.end()) { return nullptr; } return (*iter).second; } inline bool CGEngine::IsIgnored(std::string ident) { for (auto &_ignore : _ignores) { if (tools::wildcmp(_ignore, ident)) { return true; } } return false; } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_CGENGINE_H */ csg-1.6_rc1/include/votca/csg/cgmoleculedef.h000066400000000000000000000047631357201131600211740ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_CGMOLECULEDEF_H #define _VOTCA_CSG_CGMOLECULEDEF_H #include #include #include #include #include "exclusionlist.h" #include "map.h" #include "molecule.h" #include #include namespace votca { namespace csg { /** \brief definition of a coarse grained molecule This class is to define a coarse grained molecule, which includes the topology, mapping, ... \todo clean up this class, do the bonded interactions right!!!! \todo check for consistency of xml file, seperate xml parser and class!! */ class CGMoleculeDef { public: CGMoleculeDef() = default; ~CGMoleculeDef(); Molecule *CreateMolecule(Topology &top); Map *CreateMap(Molecule &in, Molecule &out); void Load(std::string filename); const std::string &getName() { return _name; } const std::string &getIdent() { return _ident; } private: tools::Property _options; struct beaddef_t { std::string _name; std::string _type; Bead::Symmetry _symmetry; std::string _mapping; std::vector _subbeads; tools::Property *_options; }; // name of the coarse grained molecule std::string _name; // name of the molecule to coarse grain std::string _ident; // beads of the cg molecule std::vector _beads; std::map _beads_by_name; // mapping schemes std::map _maps; std::vector _bonded; void ParseTopology(tools::Property &options); void ParseBeads(tools::Property &options); void ParseBonded(tools::Property &options); void ParseMapping(tools::Property &options); beaddef_t *getBeadByName(const std::string &name); tools::Property *getMapByName(const std::string &name); }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_CGMOLECULEDEF_H */ csg-1.6_rc1/include/votca/csg/cgobserver.h000066400000000000000000000030641357201131600205300ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_CGOBSERVER_H #define _VOTCA_CSG_CGOBSERVER_H #include "topology.h" namespace votca { namespace csg { /** \brief Observer class for analysis hook Each application which performs analysis operations should use CGEngine. It offers a hook (callback class) during the coarse-graining process to evaluate each frame. The user does not have to take care about mapping and other stoff. Just oberload this class and analyze properties of interest. */ class CGObserver { public: /// \brief called before the first frame virtual void BeginCG(Topology *top, Topology *top_atom = nullptr) = 0; /// \brief called after the last frame virtual void EndCG() = 0; // \brief called for each frame which is mapped virtual void EvalConfiguration(Topology *top, Topology *top_atom = nullptr) = 0; }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_CGOBSERVER_H */ csg-1.6_rc1/include/votca/csg/csgapplication.h000066400000000000000000000120441357201131600213650ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_APPLICATION_H #define _VOTCA_CSG_APPLICATION_H #include "cgobserver.h" #include "topology.h" #include "topologymap.h" #include "trajectoryreader.h" #include #include #include namespace votca { namespace csg { class CsgApplication : public tools::Application { public: CsgApplication() = default; ~CsgApplication() override = default; void Initialize() override; bool EvaluateOptions() override; void Run(void) override; void ShowHelpText(std::ostream &out) override; /// \brief overload and return true to enable mapping command line options virtual bool DoMapping(void) { return false; } /// \brief if DoMapping is true, will by default require mapping or not virtual bool DoMappingDefault(void) { return true; } /// \brief overload and return true to enable trajectory command line options virtual bool DoTrajectory(void) { return false; } /* \brief overload and return true to enable threaded calculations */ virtual bool DoThreaded(void) { return false; } /* \brief overload and return false to disable synchronized (while threaded) * calculations */ virtual bool SynchronizeThreads(void) { if (DoThreaded()) { return true; } else { return false; } } /// \brief if topology is always needed virtual bool NeedsTopology(void) { return true; } /// \brief called after topology was loaded virtual bool EvaluateTopology(Topology *, Topology * = nullptr) { return true; } void AddObserver(CGObserver *observer); /// \brief called before the first frame virtual void BeginEvaluate(Topology *top, Topology *top_ref = nullptr); /// \brief called after the last frame virtual void EndEvaluate(); // \brief called for each frame which is mapped virtual void EvalConfiguration(Topology *top, Topology *top_ref = nullptr); // thread related stuff follows /** \brief Worker, derived from Thread, does the work. * * Worker holds the information about the current frame, either in its * own copy (e.g. Topology), or, by reference, from the parent CsgApplication. * The computation is shifted from Run() into EvalConfiguration. The * user is required to overload ForkWorker and Mergeworker and thereby * define the initialization and merging of workers. By default, workers * will be executed in correct order according to the frames. Also, * output will follow the same order. * Mutexes handle the locking of input/output and are also used to impose * the correct order of frames for in/output. * */ class Worker : public tools::Thread { public: Worker() = default; ~Worker() override; /// \brief overload with the actual computation virtual void EvalConfiguration(Topology *top, Topology *top_ref = nullptr) = 0; /// \brief returns worker id Index getId() { return _id; } protected: CsgApplication *_app = nullptr; Topology _top, _top_cg; TopologyMap *_map = nullptr; Index _id = -1; void Run(void) override; void setApplication(CsgApplication *app) { _app = app; } void setId(Index id) { _id = id; } friend class CsgApplication; }; /** * \brief Gets frames from TrajectoryReader in an ordered way and, if * successful, calls Worker::EvalConfiguration for that frame. * * @param worker * @return True if frames left for calculation, else False */ bool ProcessData(Worker *worker); /** * * User is required to overload ForkWorker and initialize workers. * @return worker */ virtual Worker *ForkWorker(void); /** * User is required to overload MergeWorker and merge data from each worker. * @param worker */ virtual void MergeWorker(Worker *worker); protected: std::list _observers; bool _do_mapping; std::vector _myWorkers; Index _nframes; bool _is_first_frame; Index _nthreads; tools::Mutex _nframesMutex; tools::Mutex _traj_readerMutex; /// \brief stores Mutexes used to impose order for input std::vector _threadsMutexesIn; /// \brief stores Mutexes used to impose order for output std::vector _threadsMutexesOut; TrajectoryReader *_traj_reader; }; inline void CsgApplication::AddObserver(CGObserver *observer) { _observers.push_back(observer); } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_APPLICATION_H */ csg-1.6_rc1/include/votca/csg/exclusionlist.h000066400000000000000000000106501357201131600212730ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_EXCLUSIONLIST_H #define _VOTCA_CSG_EXCLUSIONLIST_H #include "bead.h" #include #include #include namespace votca { namespace csg { /// \todo fill _excl_by_bead /// \todo no ids but pointers, use PairList class Topology; class Bead; class ExclusionList { public: ExclusionList() = default; ~ExclusionList() { Clear(); } void Clear(void); template void Remove(iteratable &l); template void ExcludeList(iteratable &l); struct exclusion_t { Bead *_atom; std::list _exclude; }; void CreateExclusions(Topology *top); exclusion_t *GetExclusions(Bead *bead); using iterator = std::list::iterator; iterator begin() { return _exclusions.begin(); } iterator end() { return _exclusions.end(); } bool IsExcluded(Bead *bead1, Bead *bead2); template void InsertExclusion(Bead *bead, iteratable &excluded); void InsertExclusion(Bead *bead1, Bead *bead2); void RemoveExclusion(Bead *bead1, Bead *bead2); private: std::list _exclusions; std::map _excl_by_bead; friend std::ostream &operator<<(std::ostream &out, ExclusionList &exl); }; inline ExclusionList::exclusion_t *ExclusionList::GetExclusions(Bead *bead) { std::map::iterator iter = _excl_by_bead.find(bead); if (iter == _excl_by_bead.end()) { return nullptr; } return (*iter).second; } template inline void ExclusionList::Remove(iteratable &l) { typename iteratable::iterator i, j; for (i = l.begin(); i != l.end(); ++i) { for (j = i; j != l.end(); ++j) { RemoveExclusion(*i, *j); } } } template inline void ExclusionList::ExcludeList(iteratable &l) { typename iteratable::iterator i, j; for (i = l.begin(); i != l.end(); ++i) { for (j = i; j != l.end(); ++j) { InsertExclusion(*i, *j); } } } template inline void ExclusionList::InsertExclusion(Bead *bead1_, iteratable &l) { for (typename iteratable::iterator i = l.begin(); i != l.end(); ++i) { Bead *bead1 = bead1_; Bead *bead2 = *i; if (bead2->getId() < bead1->getId()) { std::swap(bead1, bead2); } if (bead1 == bead2) { continue; } if (IsExcluded(bead1, bead2)) { continue; } exclusion_t *e; if ((e = GetExclusions(bead1)) == nullptr) { e = new exclusion_t; e->_atom = bead1; _exclusions.push_back(e); _excl_by_bead[bead1] = e; } e->_exclude.push_back(bead2); } } // template<> inline void ExclusionList::InsertExclusion(Bead *bead1, Bead *bead2) { if (bead2->getId() < bead1->getId()) { std::swap(bead1, bead2); } if (bead1 == bead2) { return; } if (IsExcluded(bead1, bead2)) { return; } exclusion_t *e; if ((e = GetExclusions(bead1)) == nullptr) { e = new exclusion_t; e->_atom = bead1; _exclusions.push_back(e); _excl_by_bead[bead1] = e; } e->_exclude.push_back(bead2); } inline void ExclusionList::RemoveExclusion(Bead *bead1, Bead *bead2) { if (bead2->getId() < bead1->getId()) { std::swap(bead1, bead2); } if (bead1 == bead2) { return; } if (!IsExcluded(bead1, bead2)) { return; } std::list::iterator ex; for (ex = _exclusions.begin(); ex != _exclusions.end(); ++ex) { if ((*ex)->_atom == bead1) { break; } if (ex == _exclusions.end()) { return; } (*ex)->_exclude.remove(bead2); if ((*ex)->_exclude.empty()) { (*ex) = nullptr; _exclusions.erase(ex); } _exclusions.remove(nullptr); } } std::ostream &operator<<(std::ostream &out, ExclusionList &ex); } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_EXCLUSIONLIST_H */ csg-1.6_rc1/include/votca/csg/fileformatfactory.h000066400000000000000000000031461357201131600221100ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_FILEFORMATFACTORY_H #define _VOTCA_CSG_FILEFORMATFACTORY_H #include #include #include namespace votca { namespace csg { namespace TOOLS = votca::tools; template class FileFormatFactory : public TOOLS::ObjectFactory { public: FileFormatFactory() = default; T *Create(const std::string &file); }; template T *FileFormatFactory::Create(const std::string &file) { std::string filetype = tools::filesystem::GetFileExtension(file); try { return TOOLS::ObjectFactory::Create(filetype); } catch (std::exception &) { throw std::runtime_error("Error '" + filetype + "' file format of file " "'" + file + "' cannot be read or written"); } return nullptr; } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_FILEFORMATFACTORY_H */ csg-1.6_rc1/include/votca/csg/imcio.h000066400000000000000000000027411357201131600174700ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_IMCIO_H #define _VOTCA_CSG_IMCIO_H #include #include #include #include #include namespace votca { namespace csg { void imcio_write_dS(const std::string &file, const tools::Table &dS, const std::list *list = nullptr); void imcio_write_matrix(const std::string &file, const Eigen::MatrixXd &gmc, const std::list *list = nullptr); void imcio_write_index( const std::string &file, const std::vector > &ranges); Eigen::MatrixXd imcio_read_matrix(const std::string &filename); std::vector > imcio_read_index( const std::string &filename); } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_IMCIO_H */ csg-1.6_rc1/include/votca/csg/interaction.h000066400000000000000000000216121357201131600207050ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_INTERACTION_H #define _VOTCA_CSG_INTERACTION_H #include "bead.h" #include "topology.h" #include #include namespace votca { namespace csg { /** \brief base class for all interactions This is the base class for all interactions. \todo double names/groups right, add molecules!! */ class Interaction { public: Interaction() = default; virtual ~Interaction() = default; virtual double EvaluateVar(const Topology &top) = 0; std::string getName() const { return _name; } void setGroup(const std::string &group) { _group = group; RebuildName(); } const std::string &getGroup() const { assert(_group.compare("") != 0); return _group; } // the group id is set by topology, when interaction is added to it // \todo if the group name is changed later, group id should be updated by // topology Index getGroupId() { assert(_group_id != -1); return _group_id; } void setGroupId(Index id) { _group_id = id; } void setIndex(const Index &index) { _index = index; RebuildName(); } const Index &getIndex() const { assert(_index != -1); return _index; } void setMolecule(const Index &mol) { _mol = mol; RebuildName(); } const Index &getMolecule() const { assert(_mol != -1); return _mol; } virtual Eigen::Vector3d Grad(const Topology &top, Index bead) = 0; Index BeadCount() { return _beads.size(); } Index getBeadId(Index bead) { assert(bead > -1 && boost::lexical_cast(bead) < _beads.size()); return _beads[bead]; } protected: Index _index = -1; std::string _group = ""; Index _group_id = -1; std::string _name = ""; Index _mol = -1; std::vector _beads; void RebuildName(); }; inline void Interaction::RebuildName() { std::stringstream s; if (_mol != -1) { { s << "molecule " << _mol; } } if (!_group.empty()) { s << ":" << _group; if (_group_id != -1) { s << " " << _group_id; } } if (_index != -1) { { s << ":index " << _index; } } _name = s.str(); } /** \brief bond interaction */ class IBond : public Interaction { public: IBond(Index bead1, Index bead2) { _beads.resize(2); _beads[0] = bead1; _beads[1] = bead2; } IBond(std::list &beads) { assert(beads.size() >= 2); _beads.resize(2); for (Index i = 0; i < 2; ++i) { _beads[i] = beads.front(); beads.pop_front(); } } double EvaluateVar(const Topology &top) override; Eigen::Vector3d Grad(const Topology &top, Index bead) override; private: }; /** \brief angle interaction */ class IAngle : public Interaction { public: IAngle(Index bead1, Index bead2, Index bead3) { _beads.resize(3); _beads[0] = bead1; _beads[1] = bead2; _beads[2] = bead3; } IAngle(std::list &beads) { assert(beads.size() >= 3); _beads.resize(3); for (Index i = 0; i < 3; ++i) { _beads[i] = beads.front(); beads.pop_front(); } } double EvaluateVar(const Topology &top) override; Eigen::Vector3d Grad(const Topology &top, Index bead) override; private: }; /** \brief dihedral interaction */ class IDihedral : public Interaction { public: IDihedral(Index bead1, Index bead2, Index bead3, Index bead4) { _beads.resize(4); _beads[0] = bead1; _beads[1] = bead2; _beads[2] = bead3; _beads[3] = bead4; } IDihedral(std::list &beads) { assert(beads.size() >= 4); _beads.resize(4); for (Index i = 0; i < 4; ++i) { _beads[i] = beads.front(); beads.pop_front(); } } double EvaluateVar(const Topology &top) override; Eigen::Vector3d Grad(const Topology &top, Index bead) override; private: }; inline double IBond::EvaluateVar(const Topology &top) { return top.getDist(_beads[0], _beads[1]).norm(); } inline Eigen::Vector3d IBond::Grad(const Topology &top, Index bead) { Eigen::Vector3d r = top.getDist(_beads[0], _beads[1]); r.normalize(); return (bead == 0) ? -r : r; } inline double IAngle::EvaluateVar(const Topology &top) { Eigen::Vector3d v1(top.getDist(_beads[1], _beads[0])); Eigen::Vector3d v2(top.getDist(_beads[1], _beads[2])); return std::acos(v1.dot(v2) / sqrt(v1.squaredNorm() * v2.squaredNorm())); } inline Eigen::Vector3d IAngle::Grad(const Topology &top, Index bead) { Eigen::Vector3d v1(top.getDist(_beads[1], _beads[0])); Eigen::Vector3d v2(top.getDist(_beads[1], _beads[2])); double acos_prime = 1.0 / (sqrt(1 - std::pow(v1.dot(v2), 2) / (v1.squaredNorm() * v2.squaredNorm()))); switch (bead) { case (0): return acos_prime * (-v2 / (v1.norm() * v2.norm()) + (v1.dot(v2) * v1) / (v1.squaredNorm() * v2.squaredNorm())); break; case (1): return acos_prime * ((v1 + v2) / (v1.norm() * v2.norm()) - (v1.dot(v2)) * (v2.squaredNorm() * v1 + v1.squaredNorm() * v2) / (std::pow(v1.norm(), 3) * std::pow(v2.norm(), 3))); break; case (2): return acos_prime * (-v1 / (v1.norm() * v2.norm())) + (v1.dot(v2) * v2 / (v1.norm() * std::pow(v2.norm(), 3))); break; } // should never reach this assert(false); return Eigen::Vector3d::Zero(); } inline double IDihedral::EvaluateVar(const Topology &top) { Eigen::Vector3d v1(top.getDist(_beads[0], _beads[1])); Eigen::Vector3d v2(top.getDist(_beads[1], _beads[2])); Eigen::Vector3d v3(top.getDist(_beads[2], _beads[3])); Eigen::Vector3d n1 = v1.cross(v2); // calculate the normal vector Eigen::Vector3d n2 = v2.cross(v3); // calculate the normal vector double sign = (v1.dot(n2) < 0) ? -1 : 1; return sign * std::acos(n1.dot(n2) / sqrt(n1.squaredNorm() * n2.squaredNorm())); } inline Eigen::Vector3d IDihedral::Grad(const Topology &top, Index bead) { Eigen::Vector3d v1(top.getDist(_beads[0], _beads[1])); Eigen::Vector3d v2(top.getDist(_beads[1], _beads[2])); Eigen::Vector3d v3(top.getDist(_beads[2], _beads[3])); Eigen::Vector3d n1, n2; n1 = v1.cross(v2); // calculate the normal vector n2 = v2.cross(v3); // calculate the normal vector double sign = (v1.dot(n2) < 0) ? -1 : 1; Eigen::Vector3d returnvec; Eigen::Matrix3d e = Eigen::Matrix3d::Identity(); double acos_prime = sign * (-1.0 / (sqrt(1 - std::pow(n1.dot(n2), 2) / (n1.squaredNorm() * n2.squaredNorm())))); switch (bead) { case (0): { for (Index i = 0; i < 3; i++) { returnvec[i] = n2.dot(v2.cross(e.col(i))) / (n1.norm() * n2.norm()) - n1.dot(n2) * n1.dot(v2.cross(e.col(i))) / (n2.norm() * std::pow(n1.norm(), 3)); } return acos_prime * returnvec; break; } case (1): { for (Index i = 0; i < 3; i++) { returnvec[i] = (n1.dot(v3.cross(e.col(i))) + n2.dot(e.col(i).cross(v1) + e.col(i).cross(v2))) / (n1.norm() * n2.norm()) - n1.dot(n2) * ((n1.dot(e.col(i).cross(v1) + e.col(i).cross(v2))) / (n2.norm() * std::pow(n1.norm(), 3)) + n2.dot(v3.cross(e.col(i))) / (n1.norm() * std::pow(n2.norm(), 3))); } return acos_prime * returnvec; break; }; case (2): { for (Index i = 0; i < 3; i++) { returnvec[i] = (n1.dot(e.col(i).cross(v2) + e.col(i).cross(v3)) + n2.dot(v1.cross(e.col(i)))) / (n1.norm() * n2.norm()) - n1.dot(n2) * (n1.dot(v1.cross(e.col(i))) / (n2.norm() * std::pow(n1.norm(), 3)) + (n2.dot(e.col(i).cross(v2) + e.col(i).cross(v3))) / (n1.norm() * std::pow(n2.norm(), 3))); } return acos_prime * returnvec; break; }; case (3): { // for (Index i = 0; i < 3; i++) { returnvec[i] = n1.dot(v2.cross(e.col(i))) / (n1.norm() * n2.norm()) - n1.dot(n2) * n2.dot(v2.cross(e.col(i))) / (n1.norm() * std::pow(n2.norm(), 3)); } return acos_prime * returnvec; break; }; } // should never reach this assert(false); return Eigen::Vector3d::Zero(); } } // namespace csg } // namespace votca #endif // _VOTCA_CSG_INTERACTION_H csg-1.6_rc1/include/votca/csg/map.h000066400000000000000000000060071357201131600171440ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_MAP_H #define _VOTCA_CSG_MAP_H #include "molecule.h" #include #include #include namespace votca { namespace csg { class BeadMap; /******************************************************* Mapper class, collection of maps *******************************************************/ class Map { public: Map(Molecule &in, Molecule &out) : _in(in), _out(out) {} ~Map(); void AddBeadMap(BeadMap *bmap) { _maps.push_back(bmap); } void Apply(); protected: Molecule _in, _out; std::vector _maps; }; /******************************************************* Interface for all maps *******************************************************/ class BeadMap { public: virtual ~BeadMap() = default; virtual void Apply() = 0; virtual void Initialize(Molecule *in, Bead *out, tools::Property *opts_map, tools::Property *opts_bead); protected: Molecule *_in; Bead *_out; tools::Property *_opts_map; tools::Property *_opts_bead; }; inline void BeadMap::Initialize(Molecule *in, Bead *out, tools::Property *opts_bead, tools::Property *opts_map) { _in = in; _out = out; _opts_map = opts_map; _opts_bead = opts_bead; } /******************************************************* Linear map for spherical beads *******************************************************/ class Map_Sphere : public BeadMap { public: Map_Sphere() = default; void Apply() override; void Initialize(Molecule *in, Bead *out, tools::Property *opts_bead, tools::Property *opts_map) override; protected: void AddElem(Bead *in, double weight, double force_weight); struct element_t { Bead *_in; double _weight; double _force_weight; }; std::vector _matrix; }; inline void Map_Sphere::AddElem(Bead *in, double weight, double force_weight) { element_t el; el._in = in; el._weight = weight; el._force_weight = force_weight; _matrix.push_back(el); } /******************************************************* Linear map for ellipsoidal bead *******************************************************/ class Map_Ellipsoid : public Map_Sphere { public: Map_Ellipsoid() = default; void Apply() override; protected: }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_MAP_H */ csg-1.6_rc1/include/votca/csg/molecule.h000066400000000000000000000061251357201131600201750ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_MOLECULE_H #define _VOTCA_CSG_MOLECULE_H #include "bead.h" #include "topologyitem.h" #include #include #include #include namespace votca { namespace csg { class Interaction; /** \brief information about molecules The Molecule class stores which beads belong to a molecule. The organization of beads into molecules is needed for the CG mapping. \todo sort atoms in molecule */ class Molecule : public TopologyItem { public: /// get the molecule ID Index getId() const { return _id; } /// get the name of the molecule const std::string &getName() const { return _name; } /// set the name of the molecule void setName(const std::string &name) { _name = name; } /// Add a bead to the molecule void AddBead(Bead *bead, const std::string &name); /// get the id of a bead in the molecule Bead *getBead(Index bead) { return _beads[bead]; } Index getBeadId(Index bead) { return _beads[bead]->getId(); } Index getBeadIdByName(const std::string &name); /// get the number of beads in the molecule Index BeadCount() const { return _beads.size(); } const std::vector &Beads() const { return _beads; } std::vector &Beads() { return _beads; } /// find a bead by it's name Index getBeadByName(const std::string &name); std::string getBeadName(Index bead) { return _bead_names[bead]; } /// Add an interaction to the molecule void AddInteraction(Interaction *ic) { _interactions.push_back(ic); } std::vector Interactions() { return _interactions; } template void setUserData(T *userdata) { _userdata = (void *)userdata; } template T *getUserData() { return (T *)_userdata; } private: // maps a name to a bead id std::map _beadmap; std::vector _interactions; // id of the molecules Index _id; // name of the molecule std::string _name; // the beads in the molecule std::vector _beads; std::vector _bead_names; void *_userdata; /// constructor Molecule(Topology *parent, Index id, std::string name) : TopologyItem(parent), _id(id), _name(name) {} friend class Topology; }; inline Index Molecule::getBeadIdByName(const std::string &name) { Index i = getBeadByName(name); if (i < 0) { { return i; } } return _beads[i]->getId(); } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_MOLECULE_H */ csg-1.6_rc1/include/votca/csg/moleculeitem.h000066400000000000000000000024121357201131600210470ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_MOLECULEITEM_H #define _VOTCA_CSG_MOLECULEITEM_H #include namespace votca { namespace csg { class Molecule; class MoleculeItem { public: virtual ~MoleculeItem() = default; /** * Returns the molecule the pointer points at */ Molecule *getMolecule() const { assert(_mol != nullptr); return _mol; } /** * stores a pointer to a molecule */ void setMolecule(Molecule *mol) { _mol = mol; } protected: MoleculeItem(Molecule *mol) : _mol(mol) {} Molecule *_mol = nullptr; friend class BaseBead; }; } // namespace csg } // namespace votca #endif // _VOTCA_CSG_MOLECULEITEM_H csg-1.6_rc1/include/votca/csg/nblist.h000066400000000000000000000136341357201131600176660ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_NBLIST_H #define _VOTCA_CSG_NBLIST_H #include "beadlist.h" #include "beadpair.h" #include "exclusionlist.h" #include "pairlist.h" namespace votca { namespace csg { namespace TOOLS = votca::tools; /** * \brief Neighbour list class * * Implements a simple N^2 neighbour search and stores neigbourlist with pair * structure. User defined criteria can be added by SetMatchFunction. To only * get every pair listed once, the SetMatchFunction can be used and always * return that the pair is not stored. * */ class NBList : public PairList { public: NBList(); ~NBList() override; /// Generate the neighbour list based on two bead lists (e.g. bead types) virtual void Generate(BeadList &list1, BeadList &list2, bool do_exclusions = true); /// Generate the neighbour list based on a single bead list virtual void Generate(BeadList &list, bool do_exclusions = true) { Generate(list, list, do_exclusions); } /// set the cutoff for the neighbour search void setCutoff(double cutoff) { _cutoff = cutoff; } /// get the cutoff for the neighbour search double getCutoff() { return _cutoff; } /** * \brief match function for class member functions * * SetMatchFunction can be used to specify additional criteria, weather two * beads are added to the list of pairs or not. The function gets the two * two beads and the distance vector as argument. If a pair should be added, * the function should return true, otherwise false. * * This function can also be used, in a situation where each pair needs only * to be processed once, but the total number of pairs is to big to be stored * in memory, e.g. to calculate rdf for huge systems. In this case, set a * match function which always returns false (->no pair is added), and do * the processing in the match function. */ template void SetMatchFunction(T *object, bool (T::*fkt)(Bead *, Bead *, const Eigen::Vector3d &, const double dist)); /// \brief match function for static member functions or plain functions void SetMatchFunction(bool (*fkt)(Bead *, Bead *, const Eigen::Vector3d &, const double dist)); /// standard match function static bool match_always(Bead *, Bead *, const Eigen::Vector3d &, const double) { return true; } /// function to use a user defined pair type template void setPairType(); protected: /// cutoff double _cutoff; /// take into account exclusions from topolgoy bool _do_exclusions; /// policy function to create new bead types template static BeadPair *beadpair_create_policy(Bead *bead1, Bead *bead2, const Eigen::Vector3d &r) { return dynamic_cast(new pair_type(bead1, bead2, r)); } using pair_creator_t = BeadPair *(*)(Bead *, Bead *, const Eigen::Vector3d &); /// the current bead pair creator function pair_creator_t _pair_creator; protected: /// Functor for match function to be able to set member and non-member /// functions class Functor { public: Functor() = default; virtual bool operator()(Bead *, Bead *, const Eigen::Vector3d &, const double dist) = 0; virtual ~Functor() = default; }; /// Functor for member functions template class FunctorMember : public Functor { public: using fkt_t = bool (T::*)(Bead *, Bead *, const Eigen::Vector3d &, const double); FunctorMember(T *cls, fkt_t fkt) : _cls(cls), _fkt(fkt) {} bool operator()(Bead *b1, Bead *b2, const Eigen::Vector3d &r, const double dist) override { return (_cls->*_fkt)(b1, b2, r, dist); } private: T *_cls; fkt_t _fkt; }; /// Functor for non-member functions class FunctorNonMember : public Functor { public: using fkt_t = bool (*)(Bead *, Bead *, const Eigen::Vector3d &, const double); FunctorNonMember(fkt_t fkt) : _fkt(fkt) {} bool operator()(Bead *b1, Bead *b2, const Eigen::Vector3d &r, const double dist) override { return (*_fkt)(b1, b2, r, dist); } private: fkt_t _fkt; }; Functor *_match_function; }; template void NBList::setPairType() { _pair_creator = NBList::beadpair_create_policy; } template inline void NBList::SetMatchFunction(T *object, bool (T::*fkt)(Bead *, Bead *, const Eigen::Vector3d &, const double)) { if (_match_function) { delete _match_function; } _match_function = dynamic_cast(new FunctorMember(object, fkt)); } inline void NBList::SetMatchFunction(bool (*fkt)(Bead *, Bead *, const Eigen::Vector3d &, const double)) { if (_match_function) { delete _match_function; } _match_function = dynamic_cast(new FunctorNonMember(fkt)); } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_NBLIST_H */ csg-1.6_rc1/include/votca/csg/nblist_3body.h000066400000000000000000000203511357201131600207600ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_NBLIST_3BODY_H #define _VOTCA_CSG_NBLIST_3BODY_H #include "beadlist.h" #include "beadtriple.h" #include "exclusionlist.h" #include "triplelist.h" namespace votca { namespace csg { /** * \brief Neighbour list class for 3 body interactions * * Implements a simple N^3 neighbour search and stores 3body neigbourlist with * triple structure. * * * User defined criteria can be added by SetMatchFunction. To only * get every pair listed once, the SetMatchFunction can be used and always * return that the pair is not stored. * */ class NBList_3Body : public TripleList { public: NBList_3Body(); ~NBList_3Body() override; /// Generate the 3body neighbour list based on three bead lists (e.g. bead /// types) virtual void Generate(BeadList &list1, BeadList &list2, BeadList &list3, bool do_exclusions = true); /// Generate the 3body neighbour list based on two bead lists (e.g. bead /// types) Experimental: here the second and the third bead list are the same /// (nblist will have the structure bead type 1, bead type 2, bead type 2) virtual void Generate(BeadList &list1, BeadList &list2, bool do_exclusions = true) { Generate(list1, list2, list2, do_exclusions); }; /// Generate the 3body neighbour list based on a single bead list (nblist will /// have the structure bead type 1, bead type 1, bead type 1) virtual void Generate(BeadList &list, bool do_exclusions = true) { Generate(list, list, list, do_exclusions); } /// set the cutoff for the neighbour search /// to do: at the moment use only one single cutoff value void setCutoff(const double cutoff) { _cutoff = cutoff; } /// get the cutoff for the neighbour search double getCutoff() { return _cutoff; } /** * \brief match function for class member functions * * SetMatchFunction can be used to specify additional criteria, weather three * beads are added to the list of triples or not. The function gets the * three beads and the distance vectors between the beads as argument. * If a triple should be added, the function should return true, otherwise * false. * * This function can also be used, in a situation where each triple needs only * to be processed once, but the total number of triples is to big to be * stored in memory, e.g. to calculate rdf for huge systems. In this case, set * a match function which always returns false (->no triple is added), and do * the processing in the match function. */ template void SetMatchFunction( T *object, bool (T::*fkt)(Bead *, Bead *, Bead *, const Eigen::Vector3d &, const Eigen::Vector3d &, const Eigen::Vector3d &, const double dist12, const double dist13, const double dist23)); /// \brief match function for static member functions or plain functions void SetMatchFunction(bool (*fkt)( Bead *, Bead *, Bead *, const Eigen::Vector3d &, const Eigen::Vector3d &, const Eigen::Vector3d &, const double dist12, const double dist13, const double dist23)); /// standard match function static bool match_always(Bead *, Bead *, Bead *, const Eigen::Vector3d &, const Eigen::Vector3d &, const Eigen::Vector3d &, const double, const double, const double) { return true; } /// function to use a user defined triple type template void setTripleType(); protected: /// cutoff (at the moment use only one cutoff value) double _cutoff; /// take into account exclusions from topolgoy bool _do_exclusions; /// policy function to create new bead types template static BeadTriple *beadtriple_create_policy(Bead *bead1, Bead *bead2, Bead *bead3, const Eigen::Vector3d &r12, const Eigen::Vector3d &r13, const Eigen::Vector3d &r23) { return dynamic_cast( new triple_type(bead1, bead2, bead3, r12, r13, r23)); } using triple_creator_t = BeadTriple *(*)(Bead *, Bead *, Bead *, const Eigen::Vector3d &, const Eigen::Vector3d &, const Eigen::Vector3d &); /// the current bead pair creator function triple_creator_t _triple_creator; protected: /// Functor for match function to be able to set member and non-member /// functions class Functor { public: Functor() = default; virtual bool operator()(Bead *, Bead *, Bead *, const Eigen::Vector3d &, const Eigen::Vector3d &, const Eigen::Vector3d &, const double dist12, const double dist13, const double dist23) = 0; virtual ~Functor() = default; }; /// Functor for member functions template class FunctorMember : public Functor { public: using fkt_t = bool (T::*)(Bead *, Bead *, Bead *, const Eigen::Vector3d &, const Eigen::Vector3d &, const Eigen::Vector3d &, const double, const double, const double); FunctorMember(T *cls, fkt_t fkt) : _cls(cls), _fkt(fkt) {} bool operator()(Bead *b1, Bead *b2, Bead *b3, const Eigen::Vector3d &r12, const Eigen::Vector3d &r13, const Eigen::Vector3d &r23, const double dist12, const double dist13, const double dist23) override { return (_cls->*_fkt)(b1, b2, b3, r12, r13, r23, dist12, dist13, dist23); } private: T *_cls; fkt_t _fkt; }; /// Functor for non-member functions class FunctorNonMember : public Functor { public: using fkt_t = bool (*)(Bead *, Bead *, Bead *, const Eigen::Vector3d &, const Eigen::Vector3d &, const Eigen::Vector3d &, const double, const double, const double); FunctorNonMember(fkt_t fkt) : _fkt(fkt) {} bool operator()(Bead *b1, Bead *b2, Bead *b3, const Eigen::Vector3d &r12, const Eigen::Vector3d &r13, const Eigen::Vector3d &r23, const double dist12, const double dist13, const double dist23) override { return (*_fkt)(b1, b2, b3, r12, r13, r23, dist12, dist13, dist23); } private: fkt_t _fkt; }; Functor *_match_function; }; template void NBList_3Body::setTripleType() { _triple_creator = NBList_3Body::beadtriple_create_policy; } template inline void NBList_3Body::SetMatchFunction( T *object, bool (T::*fkt)(Bead *, Bead *, Bead *, const Eigen::Vector3d &, const Eigen::Vector3d &, const Eigen::Vector3d &, const double dist12, const double dist13, const double dist23)) { if (_match_function) { delete _match_function; } _match_function = dynamic_cast(new FunctorMember(object, fkt)); } inline void NBList_3Body::SetMatchFunction(bool (*fkt)( Bead *, Bead *, Bead *, const Eigen::Vector3d &, const Eigen::Vector3d &, const Eigen::Vector3d &, const double dist12, const double dist13, const double dist23)) { if (_match_function) { delete _match_function; } _match_function = dynamic_cast(new FunctorNonMember(fkt)); } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_NBLIST_3BODY_H */ csg-1.6_rc1/include/votca/csg/nblistgrid.h000066400000000000000000000034531357201131600205320ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_NBLISTGRID_H #define _VOTCA_CSG_NBLISTGRID_H #include "nblist.h" #include #include namespace votca { namespace csg { class NBListGrid : public NBList { public: void Generate(BeadList &list1, BeadList &list2, bool do_exclusions = true) override; void Generate(BeadList &list, bool do_exclusions = true) override; protected: struct cell_t { BeadList _beads; std::vector _neighbours; }; Eigen::Vector3d _box_a, _box_b, _box_c; Eigen::Vector3d _norm_a, _norm_b, _norm_c; Index _box_Na, _box_Nb, _box_Nc; std::vector _grid; Topology *_top; void InitializeGrid(const Eigen::Matrix3d &box); cell_t &getCell(const Eigen::Vector3d &r); cell_t &getCell(const Index &a, const Index &b, const Index &c); void TestBead(cell_t &cell, Bead *bead); void TestCell(cell_t &cell, Bead *bead); }; inline NBListGrid::cell_t &NBListGrid::getCell(const Index &a, const Index &b, const Index &c) { return _grid[a + _box_Na * b + _box_Na * _box_Nb * c]; } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_NBLISTGRID_H */ csg-1.6_rc1/include/votca/csg/nblistgrid_3body.h000066400000000000000000000037751357201131600216410ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_NBLISTGRID_3BODY_H #define _VOTCA_CSG_NBLISTGRID_3BODY_H #include "nblist_3body.h" #include namespace votca { namespace csg { class NBListGrid_3Body : public NBList_3Body { public: void Generate(BeadList &list1, BeadList &list2, BeadList &list3, bool do_exclusions = true) override; void Generate(BeadList &list1, BeadList &list2, bool do_exclusions = true) override; void Generate(BeadList &list, bool do_exclusions = true) override; protected: struct cell_t { BeadList _beads1; BeadList _beads2; BeadList _beads3; std::vector _neighbours; }; Eigen::Vector3d _box_a, _box_b, _box_c; Eigen::Vector3d _norm_a, _norm_b, _norm_c; Index _box_Na, _box_Nb, _box_Nc; std::vector _grid; Topology *_top; void InitializeGrid(const Eigen::Matrix3d &box); cell_t &getCell(const Eigen::Vector3d &r); cell_t &getCell(const Index &a, const Index &b, const Index &c); void TestBead(cell_t &cell, Bead *bead); }; inline NBListGrid_3Body::cell_t &NBListGrid_3Body::getCell(const Index &a, const Index &b, const Index &c) { return _grid[a + _box_Na * b + _box_Na * _box_Nb * c]; } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_NBLISTGRID_3BODY_H */ csg-1.6_rc1/include/votca/csg/nematicorder.h000066400000000000000000000026221357201131600210420ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_NEMATICORDER_H #define _VOTCA_CSG_NEMATICORDER_H #include "topology.h" #include namespace votca { namespace csg { class NematicOrder { public: NematicOrder() = default; ~NematicOrder() = default; void Process(Topology &top, const std::string &filter = "*"); Eigen::SelfAdjointEigenSolver &NematicU() { return _nemat_u; } Eigen::SelfAdjointEigenSolver &NematicV() { return _nemat_v; } Eigen::SelfAdjointEigenSolver &NematicW() { return _nemat_w; } private: Eigen::Matrix3d _mu, _mv, _mw; Eigen::SelfAdjointEigenSolver _nemat_u, _nemat_v, _nemat_w; }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_NEMATICORDER_H */ csg-1.6_rc1/include/votca/csg/openbox.h000066400000000000000000000021151357201131600200350ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_OPENBOX_H #define _VOTCA_CSG_OPENBOX_H #include "boundarycondition.h" namespace votca { namespace csg { class OpenBox : public BoundaryCondition { public: Eigen::Vector3d BCShortestConnection(const Eigen::Vector3d &r_i, const Eigen::Vector3d &r_j) const final; eBoxtype getBoxType() final { return typeOpen; } }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_OPENBOX_H */ csg-1.6_rc1/include/votca/csg/orthorhombicbox.h000066400000000000000000000022021357201131600215700ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_ORTHORHOMBICBOX_H #define _VOTCA_CSG_ORTHORHOMBICBOX_H #include "boundarycondition.h" namespace votca { namespace csg { class OrthorhombicBox : public BoundaryCondition { public: Eigen::Vector3d BCShortestConnection(const Eigen::Vector3d &r_i, const Eigen::Vector3d &r_j) const final; eBoxtype getBoxType() final { return typeOrthorhombic; } protected: }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_ORTHORHOMBICBOX_H */ csg-1.6_rc1/include/votca/csg/pairlist.h000066400000000000000000000101061357201131600202110ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_PAIRLIST_H #define _VOTCA_CSG_PAIRLIST_H #include #include #include namespace votca { namespace csg { template class PairList { public: PairList() = default; virtual ~PairList() { Cleanup(); } // this method takes ownership of p void AddPair(pair_type *p); using iterator = typename std::vector::iterator; using const_iterator = typename std::vector::const_iterator; typedef typename std::map partners; iterator begin() { return _pairs.begin(); } iterator end() { return _pairs.end(); } const_iterator begin() const { return _pairs.begin(); } const_iterator end() const { return _pairs.end(); } pair_type *front() { return _pairs.front(); } pair_type *back() { return _pairs.back(); } bool empty() const { return _pairs.empty(); } Index size() const { return Index(_pairs.size()); } void Cleanup(); pair_type *FindPair(element_type e1, element_type e2); const pair_type *FindPair(element_type e1, element_type e2) const; partners *FindPartners(element_type e1); using element_t = element_type; using pair_t = pair_type; protected: std::vector _pairs; std::map> _pair_map; }; // this method takes ownership of p template inline void PairList::AddPair(pair_type *p) { /// \todo be careful, same pair object is used, some values might change (e.g. /// sign of distance vector) _pair_map[p->first()][p->second()] = p; _pair_map[p->second()][p->first()] = p; /// \todo check if unique _pairs.push_back(p); } template inline void PairList::Cleanup() { for (auto &pair : _pairs) { delete pair; } _pairs.clear(); _pair_map.clear(); } template inline pair_type *PairList::FindPair(element_type e1, element_type e2) { typename std::map>::iterator iter1; iter1 = _pair_map.find(e1); if (iter1 == _pair_map.end()) { return nullptr; } typename partners::iterator iter2; iter2 = iter1->second.find(e2); if (iter2 == iter1->second.end()) { return nullptr; } return iter2->second; } template inline const pair_type *PairList::FindPair( element_type e1, element_type e2) const { typename std::map>::const_iterator iter1; iter1 = _pair_map.find(e1); if (iter1 == _pair_map.end()) { return nullptr; } typename partners::const_iterator iter2; iter2 = iter1->second.find(e2); if (iter2 == iter1->second.end()) { return nullptr; } return iter2->second; } template typename PairList::partners * PairList::FindPartners(element_type e1) { typename std::map>::iterator iter; if ((iter = _pair_map.find(e1)) == _pair_map.end()) { return nullptr; } return &(iter->second); } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_PAIRLIST_H */ csg-1.6_rc1/include/votca/csg/pdbwriter.h000066400000000000000000000062431357201131600203730ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _PDBWRITER_H #define _PDBWRITER_H #include #include #include #include namespace votca { namespace csg { class PDBWriter : public TrajectoryWriter { public: void Open(std::string file, bool bAppend = false) override; void Close() override; void Write(Topology *conf) override; template void WriteContainer(T &container); void WriteHeader(std::string header); void WriteBox(const Eigen::Matrix3d &box); private: template std::string getName(Atom &atom) { return atom.getElement(); } std::string getName(Bead *bead) { return bead->getName(); } template std::string getResname(T &container, Atom &) { return container.getType(); } std::string getResname(Topology &conf, Bead *bead); template Index getId(Atom &atom) { return atom.getId(); } Index getId(Bead *bead) { return bead->getId(); } template Index getResId(T &container, Atom &) { return container.getId(); } Index getResId(Topology &, Bead *bead) { return bead->getResnr() + 1; } template void writeSymmetry(Atom &) { return; } void writeSymmetry(Bead *bead); template Eigen::Vector3d getPos(Atom &atom) { return atom.getPos() * tools::conv::bohr2ang; } Eigen::Vector3d getPos(Bead *bead) { return bead->Pos() * tools::conv::nm2ang; } template T &getIterable(T &container) { return container; } BeadContainer &getIterable(Topology &top) { return top.Beads(); } std::ofstream _out; }; template inline void PDBWriter::WriteContainer(T &container) { boost::format atomfrmt( "ATOM %1$5d %2$-4s %3$-3s %4$1s%5$4d %6$8.3f%7$8.3f%8$8.3f\n"); for (auto &atom : getIterable(container)) { Eigen::Vector3d r = getPos(atom); std::string resname = getResname(container, atom); std::string atomname = getName(atom); if (resname.size() > 3) { resname = resname.substr(0, 3); } if (atomname.size() > 4) { atomname = atomname.substr(0, 4); } _out << atomfrmt % (getId(atom) % 100000) // atom serial number % atomname % resname % " " // chain identifier 1 char % getResId(container, atom) // residue sequence number % r.x() % r.y() % r.z(); // we skip the charge writeSymmetry(atom); } _out << std::flush; } } // namespace csg } // namespace votca #endif /* _PDBWRITER_H */ csg-1.6_rc1/include/votca/csg/potentialfunctions/000077500000000000000000000000001357201131600221435ustar00rootroot00000000000000csg-1.6_rc1/include/votca/csg/potentialfunctions/potentialfunction.h000066400000000000000000000055611357201131600260700ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef POTENTIALFUNCTION_H #define POTENTIALFUNCTION_H #include #include #include namespace votca { namespace csg { class PotentialFunction { public: virtual ~PotentialFunction() = default; // read parameters from the input file virtual void setParam(std::string filename); // save parameters to the file virtual void SaveParam(const std::string &filename); // write potential table virtual void SavePotTab(const std::string &filename, double step); // write potential table for specified interval virtual void SavePotTab(const std::string &filename, double step, double rmin, double rcut); // set all parameters void setParam(const Eigen::VectorXd ¶m) { _lam = param; } // set ith parameter void setParam(Index i, double val) { _lam(i) = val; } // set ith parameter among those to be optimized virtual void setOptParam(Index i, double val) { setParam(i, val); } // set minimum r value to avoid large values void setMinDist(double min) { _min = min; } // set cut-off value void setCutOffDist(double cutoff) { _cut_off = cutoff; } // calculate function virtual double CalculateF(double r) const = 0; // calculate first derivative w.r.t. ith parameter virtual double CalculateDF(Index i, double r) const = 0; // calculate second derivative w.r.t. ith parameter virtual double CalculateD2F(Index i, Index j, double r) const = 0; // return parameter Eigen::VectorXd &Params() { return _lam; } // return ith parameter double getParam(Index i) const { return _lam(i); } // return ith parameter among those to be optimized virtual double getOptParam(Index i) const { return getParam(i); } // return size of parameters Index getParamSize() const { return _lam.size(); } // return size of parameters to be optimized virtual Index getOptParamSize() const { return getParamSize(); } // return cut-off value double getCutOff() const { return _cut_off; } double getMinDist() const { return _min; } protected: PotentialFunction(const std::string &name, Index nlam, double min, double max); std::string _name; Eigen::VectorXd _lam; double _cut_off; double _min; }; } // namespace csg } // namespace votca #endif csg-1.6_rc1/include/votca/csg/potentialfunctions/potentialfunctioncbspl.h000066400000000000000000000046011357201131600271060ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef POTENTIALFUNCTIONCBSPL_H #define POTENTIALFUNCTIONCBSPL_H #include "potentialfunction.h" #include #include namespace votca { namespace csg { class PotentialFunctionCBSPL : public PotentialFunction { public: PotentialFunctionCBSPL(const std::string &name, const Index nlam, const double min = 0.0, const double max = 10.0); ~PotentialFunctionCBSPL() override = default; // calculate function value for given r double CalculateF(const double r) const override; // calculate first derivative w.r.t. ith parameter double CalculateDF(const Index i, const double r) const override; // calculate second derivative w.r.t. ith parameter double CalculateD2F(const Index i, const Index j, const double r) const override; Index getOptParamSize() const override; void setParam(std::string filename) override; void SaveParam(const std::string &filename) override; void SavePotTab(const std::string &filename, const double step) override; void SavePotTab(const std::string &filename, const double step, const double rmin, const double rcut) override; void setOptParam(const Index i, const double val) override; double getOptParam(const Index i) const override; void extrapolExclParam(); protected: // exclude these many first coefficients from optimization // since the region relevant to these coefficients is not sampled // the value of _nexcl is determined from rmin Index _nexcl; // fix these many coeff near the cut-off to zero to ensure // zero potential and force values near cut-off Index _ncutcoeff; Index _nbreak; double _dr; Eigen::VectorXd _rbreak; Eigen::Matrix4d _M; }; } // namespace csg } // namespace votca #endif csg-1.6_rc1/include/votca/csg/potentialfunctions/potentialfunctionlj126.h000066400000000000000000000027021357201131600266410ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef POTENTIALFUNCTIONLJ126_H #define POTENTIALFUNCTIONLJ126_H #include "potentialfunction.h" #include #include namespace votca { namespace csg { // LJ 12-6 potential class // with c12,c6 parameters class PotentialFunctionLJ126 : public PotentialFunction { public: PotentialFunctionLJ126(const std::string &name, double min = 0.0, double max = 10.0); ~PotentialFunctionLJ126() override = default; // calculate function value for given r double CalculateF(double r) const override; // calculate first derivative w.r.t. ith parameter double CalculateDF(Index i, double r) const override; // calculate second derivative w.r.t. ith parameter double CalculateD2F(Index i, Index j, double r) const override; }; } // namespace csg } // namespace votca #endif csg-1.6_rc1/include/votca/csg/potentialfunctions/potentialfunctionljg.h000066400000000000000000000026341357201131600265630ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef POTENTIALFUNCTIONLJG_H #define POTENTIALFUNCTIONLJG_H #include "potentialfunction.h" namespace votca { namespace csg { // LJ 12-6 potential class // with c12,c6 parameters class PotentialFunctionLJG : public PotentialFunction { public: PotentialFunctionLJG(const std::string &name, double min = 0.0, double max = 10.0); ~PotentialFunctionLJG() override = default; // calculate function value for given r double CalculateF(double r) const override; // calculate first derivative w.r.t. ith parameter double CalculateDF(Index i, double r) const override; // calculate second derivative w.r.t. ith parameter double CalculateD2F(Index i, Index j, double r) const override; }; } // namespace csg } // namespace votca #endif /* POTFUNCTION_LJG_H */ csg-1.6_rc1/include/votca/csg/residue.h000066400000000000000000000030321357201131600200220ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_RESIDUE_H #define _VOTCA_CSG_RESIDUE_H #include "topologyitem.h" #include namespace votca { namespace csg { /** \brief class for a residue The Residue class describes a residue. When reading in the atoms, all beads belong to a residue. Later on, the molecules can be organized into molecules based on their residue. */ class Residue : public TopologyItem { public: /// get the name of the residue const std::string &getName(); /// get the name of the residue const Index &getId() const { return _id; } private: Index _id; std::string _name; private: /// constructor Residue(Topology *parent, Index id, const std::string &name) : TopologyItem(parent), _id(id), _name(name) {} friend class Topology; }; inline const std::string &Residue::getName() { return _name; } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_RESIDUE_H */ csg-1.6_rc1/include/votca/csg/topology.h000066400000000000000000000300051357201131600202360ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_TOPOLOGY_H #define _VOTCA_CSG_TOPOLOGY_H #include #include #include #include #include #include "bead.h" #include "beadtype.h" #include "boundarycondition.h" #include "exclusionlist.h" #include "molecule.h" #include "openbox.h" #include "orthorhombicbox.h" #include "residue.h" #include "triclinicbox.h" #include namespace votca { namespace csg { class Interaction; using MoleculeContainer = std::vector; using BeadContainer = std::vector; using ResidueContainer = std::vector; using InteractionContainer = std::vector; /** * \brief topology of the whole system * * The Topology class stores the topology of the system like the beads, bonds, * molecules and residues. * **/ class Topology { public: /// constructor Topology() { _bc = new OpenBox(); } virtual ~Topology(); /** * \brief Cleans up all the stored data */ virtual void Cleanup(); /** * \brief Creates a new Bead * * \param[in] symmetry symmetry of the bead, 1: spherical 3: ellipsoidal * \param[in] name name of the bead * \param[in] type bead type * \param[in] resnr residue number * \param[in] m mass * \param[in] q charge * \return pointer to created bead * * The function creates a new bead and adds it to the list of beads. */ virtual Bead *CreateBead(Bead::Symmetry symmetry, std::string name, std::string type, Index resnr, double m, double q); /** * \brief Creates a new molecule * \param[in] name name of the molecule * \return pointer to created molecule */ virtual Molecule *CreateMolecule(std::string name); /** * \brief checks weather molecules with the same name really contain the same * number of beads */ void CheckMoleculeNaming(void); /** * \brief Create a new resiude. * * @param[in] name residue name * @return created residue */ virtual Residue *CreateResidue(std::string name); virtual Residue *CreateResidue(std::string name, Index id); /** * \brief Create molecules based on the residue. * * This function scans the topology and creates molecules based on the resiude * id. All beads with the same resid are put Index one molecule. */ void CreateMoleculesByResidue(); /** * \brief put the whole topology in one molecule * \param name name of the new molecule * * This function creates one big molecule for all beads in the topology. */ void CreateOneBigMolecule(std::string name); /** * \brief create molecules based on blocks of atoms * \param[in] name molecule name * \param[in] first first bead * \param[in] nbeads number of beads per molecule * \param[in] nmolecules number of molecules */ void CreateMoleculesByRange(std::string name, Index first, Index nbeads, Index nmolecules); /** * \brief number of molecules in the system * @return number of molecule in topology */ Index MoleculeCount() const { return _molecules.size(); } /** * number of beads in the system * @return number of beads in the system */ Index BeadCount() const { return _beads.size(); } /** * number of residues in the system * \return number of residues */ Index ResidueCount() const { return _residues.size(); } /** * get molecule by index * @param index molecule number * @return pointer to molecule */ Molecule *MoleculeByIndex(Index index); /** * access containter with all beads * @return bead container */ BeadContainer &Beads() { return _beads; } /** * access containter with all residues * @return bead container */ ResidueContainer &Residues() { return _residues; } /** * access containter with all molecules * @return molecule container */ MoleculeContainer &Molecules() { return _molecules; } const MoleculeContainer &Molecules() const { return _molecules; } /** * access containter with all bonded interactions * @return bonded interaction container */ InteractionContainer &BondedInteractions() { return _interactions; } void AddBondedInteraction(Interaction *ic); std::list InteractionsInGroup(const std::string &group); /** * \brief Determine if a bead type exists. * * @return bool true if it has been registered **/ bool BeadTypeExist(std::string type) const; /** * \brief Register the bead type with the topology object. * * Records are kept of the different bead types in the topology object. This * method stores the bead type. **/ void RegisterBeadType(std::string name); /** * \brief Given a bead type this method returns the id associated with the * type * * @param[in] string name of the type * @return Index the id of the type **/ Index getBeadTypeId(std::string type) const; /** * \brief Returns a pointer to the bead with index i * * @param[in] Index i is the id of the bead * @return Bead * is a pointer to the bead **/ Bead *getBead(const Index i) const { return _beads[i]; } Residue *getResidue(const Index i) const { return _residues[i]; } Molecule *getMolecule(const Index i) const { return _molecules[i]; } /** * delete all molecule information */ void ClearMoleculeList() { _molecules.clear(); } /** * \brief adds all the beads+molecules+residues from other topology * \param top topology to add */ void Add(Topology *top); /** * \brief copy topology data of different topology * \param top topology to copy from */ void CopyTopologyData(Topology *top); /** * \brief rename all the molecules in range * \param range range string of type 1:2:10 = 1, 3, 5, 7, ... * \param name new name of molecule * range is a string which is parsed by RangeParser, */ void RenameMolecules(std::string range, std::string name); /** * \brief rename all the bead types * \param name current rame of the bead type * \param newname new name of bead type */ void RenameBeadType(std::string name, std::string newname); /** * \brief set the mass of all the beads of a certain type * \param name the bead type * \param value mass value */ void SetBeadTypeMass(std::string name, double value); /** * set the simulation box * \param box triclinic box matrix */ void setBox(const Eigen::Matrix3d &box, BoundaryCondition::eBoxtype boxtype = BoundaryCondition::typeAuto) { // determine box type automatically in case boxtype==typeAuto if (boxtype == BoundaryCondition::typeAuto) { boxtype = autoDetectBoxType(box); } if (_bc) { delete (_bc); } switch (boxtype) { case BoundaryCondition::typeTriclinic: _bc = new TriclinicBox(); break; case BoundaryCondition::typeOrthorhombic: _bc = new OrthorhombicBox(); break; default: _bc = new OpenBox(); break; } _bc->setBox(box); }; /** * get the simulation box * \return triclinic box matrix */ const Eigen::Matrix3d &getBox() const { return _bc->getBox(); }; /** * set the time of current frame * \param t simulation time in ns */ void setTime(double t) { _time = t; }; /** * get the time of current frame * \return simulation time in ns */ double getTime() const { return _time; }; /** * set the step number of current frame * \param s step number */ void setStep(Index s) { _step = s; }; /** * get the step number of current frame * \return step number */ Index getStep() const { return _step; }; /** * Sets the particle group. (For the H5MD file format) * \param particle_group The name of a particle group. */ void setParticleGroup(std::string particle_group) { _particle_group = particle_group; }; /** * Gets the particle group. * \return The name of a particle group. */ std::string getParticleGroup() const { return _particle_group; }; /** * \brief pbc correct distance of two beads * \param bead1 index of first bead * \param bead2 index of second bead * \return distance vector * * calculates the smallest distance between two beads with correct treatment * of pbc */ Eigen::Vector3d getDist(Index bead1, Index bead2) const; /** * \brief calculate shortest vector connecting two points * \param r1 first point * \param r2 second point * \return distance vector * * calculates the smallest distance between two points with correct treatment * of pbc */ Eigen::Vector3d BCShortestConnection(const Eigen::Vector3d &r1, const Eigen::Vector3d &r2) const; /** * \brief return the shortest box size * \return shortest size * * Calculates the shortest length to connect two sides of the box */ double ShortestBoxSize() const; /** * calculates the box volume * \return box volume */ double BoxVolume() const; /** * rebuild exclusion list */ void RebuildExclusions(); /** * access exclusion list * \return exclusion list */ ExclusionList &getExclusions() { return _exclusions; } BoundaryCondition::eBoxtype getBoxType() const { return _bc->getBoxType(); } template void InsertExclusion(Bead *bead1, iteratable &l); bool HasVel() { return _has_vel; } void SetHasVel(const bool v) { _has_vel = v; } bool HasForce() { return _has_force; } void SetHasForce(const bool v) { _has_force = v; } protected: BoundaryCondition *_bc; BoundaryCondition::eBoxtype autoDetectBoxType( const Eigen::Matrix3d &box) const; /// bead types in the topology std::unordered_map beadtypes_; /// beads in the topology BeadContainer _beads; /// molecules in the topology MoleculeContainer _molecules; /// residues in the topology ResidueContainer _residues; /// bonded interactions in the topology InteractionContainer _interactions; ExclusionList _exclusions; std::map _interaction_groups; std::map > _interactions_by_group; double _time = 0.0; Index _step = 0; bool _has_vel = false; bool _has_force = false; /// The particle group (For H5MD file format) std::string _particle_group = "unassigned"; }; inline Bead *Topology::CreateBead(Bead::Symmetry symmetry, std::string name, std::string type, Index resnr, double m, double q) { Bead *b = new Bead(this, _beads.size(), type, symmetry, name, resnr, m, q); _beads.push_back(b); return b; } inline Molecule *Topology::CreateMolecule(std::string name) { Molecule *mol = new Molecule(this, _molecules.size(), name); _molecules.push_back(mol); return mol; } inline Residue *Topology::CreateResidue(std::string name, Index id) { Residue *res = new Residue(this, id, name); _residues.push_back(res); return res; } inline Residue *Topology::CreateResidue(std::string name) { Residue *res = new Residue(this, _residues.size(), name); _residues.push_back(res); return res; } inline Molecule *Topology::MoleculeByIndex(Index index) { return _molecules[index]; } template inline void Topology::InsertExclusion(Bead *bead1, iteratable &l) { _exclusions.InsertExclusion(bead1, l); } } // namespace csg } // namespace votca #include "interaction.h" #endif /* _VOTCA_CSG_TOPOLOGY_H */ csg-1.6_rc1/include/votca/csg/topologyitem.h000066400000000000000000000021471357201131600211230ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_TOPOLOGYITEM_H #define _VOTCA_CSG_TOPOLOGYITEM_H namespace votca { namespace csg { class Topology; class TopologyItem { public: virtual ~TopologyItem() = default; Topology *getParent() const { return _parent; } protected: TopologyItem(Topology *parent) : _parent(parent) {} Topology *_parent; friend class Topology; friend class BaseBead; friend class Bead; }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_TOPOLOGYITEM_H */ csg-1.6_rc1/include/votca/csg/topologymap.h000066400000000000000000000024351357201131600207420ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_TOPOLOGYMAP_H #define _VOTCA_CSG_TOPOLOGYMAP_H #include "map.h" #include "topology.h" #include namespace votca { namespace csg { class TopologyMap { public: ~TopologyMap(); TopologyMap(Topology *in, Topology *out); void AddMoleculeMap(Map *map); void Apply(); private: Topology *_in; Topology *_out; using MapContainer = std::vector; MapContainer _maps; }; inline TopologyMap::TopologyMap(Topology *in, Topology *out) : _in(in), _out(out) {} inline void TopologyMap::AddMoleculeMap(Map *map) { _maps.push_back(map); } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_TOPOLOGYMAP_H */ csg-1.6_rc1/include/votca/csg/topologyreader.h000066400000000000000000000025161357201131600214270ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_TOPOLOGYREADER_H #define _VOTCA_CSG_TOPOLOGYREADER_H #include "fileformatfactory.h" #include "topology.h" #include namespace votca { namespace csg { class TopologyReader { public: virtual ~TopologyReader() = default; /// open, read and close topology file virtual bool ReadTopology(std::string file, Topology &top) = 0; static void RegisterPlugins(void); }; // important - singleton pattern, make sure factory is created before accessed inline FileFormatFactory &TopReaderFactory() { static FileFormatFactory _TopReaderFactory; return _TopReaderFactory; } } // namespace csg } // namespace votca #endif // _VOTCA_CSG_TOPOLOGYREADER_H csg-1.6_rc1/include/votca/csg/trajectoryreader.h000066400000000000000000000031561357201131600217420ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_TRAJECTORYREADER_H #define _VOTCA_CSG_TRAJECTORYREADER_H #include "fileformatfactory.h" #include "topology.h" #include namespace votca { namespace csg { /** \brief trajectoryreader interface This class defines the interface a trajectory reader has to implement */ class TrajectoryReader { public: virtual ~TrajectoryReader() = default; /// open a trejectory file virtual bool Open(const std::string &file) = 0; virtual void Close(){}; /// read in the first frame virtual bool FirstFrame(Topology &top) = 0; /// read in the next frame virtual bool NextFrame(Topology &top) = 0; static void RegisterPlugins(void); }; // important - singleton pattern, make sure factory is created before accessed inline FileFormatFactory &TrjReaderFactory() { static FileFormatFactory _TrjReaderFactory; return _TrjReaderFactory; } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_TRAJECTORYREADER_H */ csg-1.6_rc1/include/votca/csg/trajectorywriter.h000066400000000000000000000026551357201131600220170ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_TRAJECTORYWRITER_H #define _VOTCA_CSG_TRAJECTORYWRITER_H #include "fileformatfactory.h" #include "topology.h" #include #include #include namespace votca { namespace csg { class TrajectoryWriter { public: TrajectoryWriter() = default; virtual ~TrajectoryWriter() = default; virtual void Open(std::string, bool = false) {} virtual void Close(){}; virtual void Write(Topology *) {} static void RegisterPlugins(void); }; // important - singleton pattern, make sure factory is created before accessed inline FileFormatFactory &TrjWriterFactory() { static FileFormatFactory _TrjWriterFactory; return _TrjWriterFactory; } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_TRAJECTORYWRITER_H */ csg-1.6_rc1/include/votca/csg/triclinicbox.h000066400000000000000000000021631357201131600210570ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_TRICLINICBOX_H #define _VOTCA_CSG_TRICLINICBOX_H #include "boundarycondition.h" namespace votca { namespace csg { class TriclinicBox : public BoundaryCondition { public: Eigen::Vector3d BCShortestConnection(const Eigen::Vector3d &r_i, const Eigen::Vector3d &r_j) const final; eBoxtype getBoxType() final { return typeTriclinic; } protected: }; } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_TRICLINICBOX_H */ csg-1.6_rc1/include/votca/csg/triplelist.h000066400000000000000000000065031357201131600205630ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef _VOTCA_CSG_TRIPLELIST_H #define _VOTCA_CSG_TRIPLELIST_H #include #include namespace votca { namespace csg { template class TripleList { public: TripleList() = default; virtual ~TripleList() { Cleanup(); } void AddTriple(triple_type *t); using iterator = typename std::vector::iterator; iterator begin() { return _triples.begin(); } iterator end() { return _triples.end(); } typename std::vector::size_type size() { return _triples.size(); } triple_type *front() { return _triples.front(); } triple_type *back() { return _triples.back(); } bool empty() { return _triples.empty(); } void Cleanup(); triple_type *FindTriple(element_type e1, element_type e2, element_type e3); using element_t = element_type; using triple_t = triple_type; private: std::vector _triples; std::map>> _triple_map; }; template inline void TripleList::AddTriple(triple_type *t) { //(*t)[i] gives access to ith element of tuple object (i=0,1,2). // only consider the permutations of elements (1,2) of the tuple object -> // tuple objects of the form (*,1,2) and (*,2,1) are considered to be the same _triple_map[std::get<0>(*t)][std::get<1>(*t)][std::get<2>(*t)] = t; _triple_map[std::get<0>(*t)][std::get<2>(*t)][std::get<1>(*t)] = t; /// \todo check if unique _triples.push_back(t); } template inline void TripleList::Cleanup() { for (iterator iter = _triples.begin(); iter != _triples.end(); ++iter) { delete *iter; } _triples.clear(); _triple_map.clear(); } template inline triple_type *TripleList::FindTriple( element_type e1, element_type e2, element_type e3) { typename std::map< element_type, std::map>>::iterator iter1; iter1 = _triple_map.find(e1); if (iter1 == _triple_map.end()) { return nullptr; } typename std::map>::iterator iter2; iter2 = iter1->second.find(e2); if (iter2 == iter1->second.end()) { return nullptr; } typename std::map::iterator iter3; iter3 = iter2->second.find(e3); if (iter3 == iter2->second.end()) { return nullptr; } return iter3->second; } } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_TRIPLELIST_H */ csg-1.6_rc1/include/votca/csg/version.h000066400000000000000000000047361357201131600200630ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** \mainpage VOTCA C++ reference \section intro_sec Introduction This page is the C++ code documentation of the VOTCA package (http://www.votca.org). The main target of VOTCA is the implementation of systematic coarse-graining techniques. However, it offers a powerful, object-oriented framework to develop analysis tools for particle based molecular simulations. \section started_sec Getting started To start developing custom analysis tools, a good place to start is the csgapps repository: https://github.com/votca/csgapps It contains several small analysis tools which were implemented based upon the VOTCA framework. We highly recomment to use an IDE such as Netbeans for development since it offers lots of guides to get started with new code (code completion, code documentation popups, navigation thourh code, ...). The main container for the whole structure is the Topology, so it is a good advise to get comfortable with this class. Also the standard applications in csg/src/tools might help. \section beginner_sec For beginners: how to avoid frustration For those not familiar with object oriented code: don't try to dig into every single function in order to understand what exactly is going on. This strategy only works for very small projects and is not intended for oject oriented programs. Think about the code in layers of abstraction! Your main focus should be on the global structure and understand how objects relate to each other. The code was designed that you don't have to redo and understand all the nasty details! */ #ifndef _VOTCA_CSG_VERSION_H #define _VOTCA_CSG_VERSION_H #include namespace votca { namespace csg { const std::string &CsgVersionStr(); void HelpTextHeader(const std::string &tool_name); } // namespace csg } // namespace votca #endif /* _VOTCA_CSG_VERSION_H */ csg-1.6_rc1/include/votca/csg/xyzreader.h000066400000000000000000000107361357201131600204100ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef __VOTCA_CSG_XYZREADER_H #define __VOTCA_CSG_XYZREADER_H #include #include #include #include #include #include #include namespace votca { namespace csg { /** \brief class for reading xyz files This class provides the TrajectoryReader + Topology reader interface for xyz files */ class XYZReader : public TrajectoryReader, public TopologyReader { public: XYZReader() = default; ~XYZReader() override = default; /// open a topology file bool ReadTopology(std::string file, Topology &top) override; /// open a trajectory file bool Open(const std::string &file) override; /// read in the first frame bool FirstFrame(Topology &top) override; /// read in the next frame bool NextFrame(Topology &top) override; template void ReadFile(T &container) { if (!ReadFrame(container)) { throw std::runtime_error("Reading xyz file '" + _file + "' failed"); } } void Close() override; private: template Index getContainerSize(T &container) { return container.size(); } Index getContainerSize(Topology &container) { return container.BeadCount(); } template void AddAtom(T &container, std::string name, Index id, const Eigen::Vector3d &pos) { // the typedef returns the type of the objects the container holds using atom = typename std::iterator_traits::value_type; Eigen::Vector3d pos2 = pos * tools::conv::ang2bohr; container.push_back(atom(id, name, pos2)); } template void AddAtom(Topology &container, std::string name, Index id, const Eigen::Vector3d &pos) { Bead *b; Eigen::Vector3d posnm = pos * tools::conv::ang2nm; if (topology) { b = container.CreateBead(Bead::spherical, name + boost::lexical_cast(id), name, 0, 0, 0); } else { b = container.getBead(id); } b->setPos(posnm); } template bool ReadFrame(T &container); std::ifstream _fl; std::string _file; Index _line; }; template inline bool XYZReader::ReadFrame(T &container) { std::string line; std::getline(_fl, line); ++_line; if (!_fl.eof()) { // read the number of atoms tools::Tokenizer tok1(line, " \t"); std::vector line1 = tok1.ToVector(); if (line1.size() != 1) { throw std::runtime_error( "First line of xyz file should contain number " "of atoms/beads, nothing else."); } Index natoms = boost::lexical_cast(line1[0]); if (!topology && natoms != getContainerSize(container)) { throw std::runtime_error( "number of beads in topology and trajectory differ"); } // the title line getline(_fl, line); ++_line; // read atoms for (Index i = 0; i < natoms; ++i) { getline(_fl, line); ++_line; if (_fl.eof()) { throw std::runtime_error("unexpected end of file in xyz file"); } tools::Tokenizer tok(line, " "); std::vector fields = tok.ToVector(); if (fields.size() != 4) { throw std::runtime_error("invalide line " + boost::lexical_cast(_line) + " in xyz file\n" + line); } Eigen::Vector3d pos = Eigen::Vector3d(boost::lexical_cast(fields[1]), boost::lexical_cast(fields[2]), boost::lexical_cast(fields[3])); AddAtom(container, fields[0], i, pos); } } return !_fl.eof(); } } // namespace csg } // namespace votca #endif csg-1.6_rc1/include/votca/csg/xyzwriter.h000066400000000000000000000045711357201131600204620ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef __VOTCA_CSG_XYZWRITER_H #define __VOTCA_CSG_XYZWRITER_H #include #include #include #include namespace votca { namespace csg { class XYZWriter : public TrajectoryWriter { public: void Open(std::string file, bool bAppend = false) override; void Close() override; void Write(Topology *conf) override; template void Write(T &container, std::string header); private: template Index getSize(T &container) { return getIterable(container).size(); } template std::string getName(Atom &atom) { return atom.getElement(); } std::string getName(Bead *bead) { return bead->getName(); } template Eigen::Vector3d getPos(Atom &atom) { return atom.getPos() * tools::conv::bohr2ang; } Eigen::Vector3d getPos(Bead *bead) { return bead->Pos() * tools::conv::nm2ang; } template T &getIterable(T &container) { return container; } BeadContainer &getIterable(Topology &top) { return top.Beads(); } std::ofstream _out; }; template inline void XYZWriter::Write(T &container, std::string header) { _out << getSize(container) << "\n"; _out << header << "\n"; boost::format fmter("%1$s%2$10.5f%3$10.5f%4$10.5f\n"); for (auto &atom : getIterable(container)) { Eigen::Vector3d r = getPos(atom); // truncate strings if necessary std::string atomname = getName(atom); if (atomname.size() > 3) { atomname = atomname.substr(0, 3); } while (atomname.size() < 3) { atomname = " " + atomname; } _out << fmter % atomname % r.x() % r.y() % r.z(); } _out << std::flush; } } // namespace csg } // namespace votca #endif csg-1.6_rc1/scripts/000077500000000000000000000000001357201131600143675ustar00rootroot00000000000000csg-1.6_rc1/scripts/CMakeLists.txt000066400000000000000000000054541357201131600171370ustar00rootroot00000000000000string(TIMESTAMP VOTCA_DATE "%Y-%m-%d %H:%M:%S" UTC) configure_file(help2t2t.in ${CMAKE_CURRENT_BINARY_DIR}/help2t2t.out @ONLY) add_custom_target(help2t2t_build DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/help2t2t) add_custom_command(OUTPUT help2t2t ALL COMMAND ${CMAKE_COMMAND} -DINPUT="help2t2t.out" -DOUTPUT="help2t2t" -DGIT_EXECUTABLE="${GIT_EXECUTABLE}" -DTOP_SOURCE_DIR="${CMAKE_SOURCE_DIR}" -P ${CMAKE_MODULE_PATH}/gitscript.cmake) set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES help2t2t) foreach(SCRIPT csg_call csg_inverse) configure_file(${SCRIPT}.in ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT}.out @ONLY) add_custom_target(${SCRIPT}_build ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT}) add_custom_command(OUTPUT ${SCRIPT} COMMAND ${CMAKE_COMMAND} -DINPUT="${SCRIPT}.out" -DOUTPUT="${SCRIPT}" -DGIT_EXECUTABLE="${GIT_EXECUTABLE}" -DTOP_SOURCE_DIR="${CMAKE_SOURCE_DIR}" -P ${CMAKE_MODULE_PATH}/gitscript.cmake) if(ENABLE_TESTING OR BUILD_CSG_MANUAL) add_custom_command(TARGET ${SCRIPT}_build POST_BUILD COMMAND chmod +x ${SCRIPT}) endif(ENABLE_TESTING OR BUILD_CSG_MANUAL) set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${SCRIPT}) set_property(TARGET votca_csg APPEND PROPERTY BINARIES "${SCRIPT}") install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT} DESTINATION ${CMAKE_INSTALL_BINDIR}) if (TXT2TAGS_FOUND AND BASH) add_custom_command(OUTPUT ${SCRIPT}.man COMMAND VOTCASHARE=${CMAKE_SOURCE_DIR}/share ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT} --help > ${SCRIPT}.help COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/help2t2t ${SCRIPT}.help > ${SCRIPT}.t2t COMMAND ${TXT2TAGS_EXECUTABLE} -q -t man -i ${SCRIPT}.t2t -o ${SCRIPT}.man DEPENDS help2t2t_build ${SCRIPT}) add_custom_target(${SCRIPT}_manpage DEPENDS ${SCRIPT}.man) add_dependencies(manpages ${SCRIPT}_manpage) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT}.man DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 RENAME ${SCRIPT}.1) set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${SCRIPT}.help ${SCRIPT}.t2t) endif(TXT2TAGS_FOUND AND BASH) add_executable(VOTCA::${SCRIPT} IMPORTED GLOBAL) set_property(TARGET VOTCA::${SCRIPT} PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT}") endforeach(SCRIPT) set_target_properties(VOTCA::csg_call PROPERTIES VOTCASHARE ${PROJECT_SOURCE_DIR}/share) set_target_properties(VOTCA::csg_call PROPERTIES VOTCA_PATH "${CMAKE_CURRENT_BINARY_DIR}:${PROJECT_BINARY_DIR}/src/tools") set_target_properties(VOTCA::csg_inverse PROPERTIES VOTCA_CSG_DEFAULTS "${PROJECT_BINARY_DIR}/share/xml/csg_defaults.xml") option(WITH_RC_FILES "Install votca rc files, no need when installing under /usr" ON) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/csg-completion.bash DESTINATION ${CMAKE_INSTALL_DATADIR}/votca/rc) csg-1.6_rc1/scripts/csg-completion.bash.in000066400000000000000000000017531357201131600205640ustar00rootroot00000000000000# # Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #complete with commands filename and options _votca_csg_common_opts() { local cur myopt cur=${COMP_WORDS[COMP_CWORD]} if [[ "$cur" == --* ]]; then myopt=$( $1 --help 2> /dev/null | sed -e '/--/!d' \ -e 's/.*?\(--[A-Za-z0-9]\+\).*/\1/' | sort -u ) COMPREPLY=( $( compgen -W '$myopt' -- $cur ) ) fi } complete -F _votca_csg_common_opts -f @VOTCA_BINARIES@ csg-1.6_rc1/scripts/csg_call.in000066400000000000000000000132201357201131600164640ustar00rootroot00000000000000#!/bin/bash # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # version='@PROJECT_VERSION@ #CSG_GIT_ID#' ext_cmd="" simprog="" log="" show_share="no" #unset stuff from enviorment unset CSGXMLFILE CSGDEBUG bondtype bondname #failback define die() { echo -e "$*" >&2 exit 1 } show_help () { cat << eof ================================================== ======== VOTCA (http://www.votca.org) ======== ================================================== please submit bugs to bugs@votca.org ${0##*/}, version ${version} This script calls scripts and functions for the iterative framework. Function can be executed or shows if key1='function'. Usage: ${0##*/} [OPTIONS] key1 key2 [SCRIPT OPTIONS] Allowed options: -l, --list Show list of all script --cat Show the content of the script --show Show the path to the script --show-share Shows the used VOTCASHARE dir and exits --scriptdir DIR Set the user script dir (Used if no options xml file is given) Default: empty --options FILE Specify the options xml file to use --log FILE Specify the log file to use Default: stdout --ia-type type Specify the interaction type to use --ia-name name Specify the interaction name to use --nocolor Disable colors --sloppy-tables Allow tables without flags --debug Enable debug mode with a lot of information -h, --help Show this help Examples: * ${0##*/} table smooth [ARGUMENTS] * ${0##*/} --show run gromacs eof } while [[ ${1#-} != $1 ]]; do if [[ ${1#--} = $1 && -n ${1:2} ]]; then #short opt with arguments here: fc if [[ ${1#-[fc]} != ${1} ]]; then set -- "${1:0:2}" "${1:2}" "${@:2}" else set -- "${1:0:2}" "-${1:2}" "${@:2}" fi fi case $1 in -l | --list) ext_cmd="show_csg_tables" shift ;; --scriptdir) die "'--scriptdir' is obsolete, please specify the script path in the xml file (cg.inverse.scriptpath)" shift 2;; --simprog) die "'--simprog' is obsolete, please specify the simprog in the xml file (cg.inverse.program)" shift 2;; --options) export CSGXMLFILE="$2" [ -f "$CSGXMLFILE" ] || die "options xml file '$CSGXMLFILE' not found" shift 2;; --sloppy-tables) export VOTCA_TABLES_WITHOUT_FLAG="yes" shift ;; --log) log="$2" shift 2;; --ia-type) export bondtype="$2" shift 2;; --ia-name) export bondname="$2" shift 2;; --cat) ext_cmd="cat_external" shift;; --show) ext_cmd="source_wrapper" shift;; --show-share) show_share="yes" shift;; --nocolor) export CSGNOCOLOR="yes" shift;; -h | --help) show_help exit 0;; --debug) export CSGDEBUG="yes" shift;; -v | --version) echo "${0##*/}, version $version" exit 0;; *) die "Unknown option '$1'";; esac done if [[ -z ${VOTCASHARE} ]]; then if [ -f "${0%/*}/../share/votca/scripts/inverse/inverse.sh" ]; then #transform it to a global path export VOTCASHARE="$(cd ${0%/*}/../share/votca;pwd)" elif [ -f "@CMAKE_INSTALL_FULL_DATADIR@/votca/scripts/inverse/inverse.sh" ]; then export VOTCASHARE="@CMAKE_INSTALL_FULL_DATADIR@/votca" else echo "Error: Environment value VOTCASHARE is not defined and could not be guessed" >&2 echo "Export VOTCASHARE or source VOTCARC.bash or VOTCARC.csh" >&2 exit 1 fi else if [[ ! -f ${VOTCASHARE}/scripts/inverse/inverse.sh ]]; then echo "Error: Environment value VOTCASHARE seems to be wrong" >&2 echo "Could not find \${VOTCASHARE}/scripts/inverse/inverse.sh" >&2 echo "Export VOTCASHARE or source VOTCARC.bash or VOTCARC.csh" >&2 exit 1 fi fi if [ "$show_share" = "yes" ]; then echo "${VOTCASHARE}" exit 0 fi if [[ -f ${VOTCASHARE}/scripts/inverse/start_framework.sh ]]; then source ${VOTCASHARE}/scripts/inverse/start_framework.sh || die "Could not source start_framework.sh" else die "Could not find start_framework.sh" fi [[ -n ${CSGXMLFILE} ]] && scriptpath="$(csg_get_property --allow-empty cg.inverse.scriptpath)" > /dev/null [[ -n ${scriptpath} ]] && echo "Adding '$scriptpath to csgshare" && add_to_csgshare "$scriptpath" [[ -n ${CSGXMLFILE} ]] && simprog="$(csg_get_property --allow-empty cg.inverse.program "$simprog")" [[ -n ${simprog} ]] && echo "We are using Sim Program: $simprog" && source_function $simprog if [[ $ext_cmd = show_csg_tables ]]; then $ext_cmd exit $? fi [[ -z $1 || -z $2 ]] && die "${0##*/}: Missing argument" if [[ -n $ext_cmd ]]; then $ext_cmd $1 $2 exit $? fi #help of scripts should always work and be quiet if [[ $3 = --help ]]; then cat < /dev/null)" ]; then #in case we have an old version of csg_call without --show-share tmp="$(csg_call --show-share 2> /dev/null)" && export VOTCASHARE="$tmp" unset tmp fi #we leave --help here to have it even when #VOTCASHARE is not defined if [[ $1 = "--help" || $1 = "-h" ]]; then cat << eof ================================================== ======== VOTCA (http://www.votca.org) ======== ================================================== please submit bugs to bugs@votca.org eof if [[ -f ${VOTCASHARE}/scripts/inverse/inverse.sh ]]; then exec ${VOTCASHARE}/scripts/inverse/inverse.sh --help | \ sed -e "s/inverse\.sh/${0##*/}/g" -e "s/%version%/${version}/" exit 0 fi cat << eof ${0##*/}, version ${version} Start the script (inverse.sh) to run IBM, IMC, etc. Usage: ${0##*/} [OPTIONS] --options settings.xml Allowed options: -h, --help Show this help NOTE: this is a short help, please source VOTCARC.bash or VOTCARC.csh or export VOTCASHARE to get the full help. eof exit 0 fi #we don't know if it was done above if [[ -n "$(type -p csg_call)" ]]; then VOTCASHARE="$(csg_call --show-share)" || exit 1 export VOTCASHARE else echo "Could not find csg_call" >&2 exit 1 fi if [[ -f ${VOTCASHARE}/scripts/inverse/inverse.sh ]]; then pre="$*" [[ -n $pre && -z ${pre//*--debug*} ]] && pre="${BASH} -x " || pre="" exec ${pre} ${VOTCASHARE}/scripts/inverse/inverse.sh "$@" exit 0 else echo "${0##*/}: Could not run \${VOTCASHARE}/scripts/inverse/inverse.sh $@" >&2 exit 1 fi csg-1.6_rc1/scripts/help2t2t.in000066400000000000000000000076651357201131600164010ustar00rootroot00000000000000#! /bin/bash -e # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # version='@PROJECT_VERSION@ #CSG_GIT_ID#' die() { echo -e "$*" >&2 exit 1 } assert() { local x pipestatus=${PIPESTATUS[*]} for x in $pipestatus; do [[ $x -eq 0 ]] || die "$@" done } [ -z "$1" ] && die "Usage: ${0##*/} helpfile" prog="${1%.*}" [ -f "$1" ] || die "${0##*/}: $1 not found" #trash the header helpmsg="$(sed -e '1,10d' $1)" || die "$prog --help failed" #first block is descprition desc="$(echo "$helpmsg" | sed -n '1,/^[[:space:]]*$/p')" assert "parse of desc failed" [ -z "$desc" ] && die "Failed to fetch desc" helpmsg="$(echo "$helpmsg" | sed '1,/^[[:space:]]*$/d')" assert "cut of help msg failed" #second block can be usage line usage="$(echo "$helpmsg" | sed -n '1s/Usage:[[:space:]]*\(.*\)$/\1/p')" assert "parse of usage failed" if [ -z "$usage" ]; then usage="**$prog** \"\"[\"\"//OPTION//\"\"]\"\" \"\"[\"\"//OPTIONPARAMETERS//\"\"]\"\"" else usage="$(echo "$usage" | sed -e 's/^/**/' -e 's/ /** /' -e 's/\([][]\)/""\1""/g')" assert "parse part 2 of usage failed" helpmsg="$(echo "$helpmsg" | sed '1,/^[[:space:]]*$/d')" assert "cut of help msg failed" fi #try to find examples block exam="$(echo "$helpmsg" | sed -n '/^Examples:/,/^[[:space:]]*$/p')" || die "parse of exam failed" if [ -n "$exam" ]; then exam="$(echo "$exam" | \ sed -e '1d' \ -e '/^\* /s/\( \{2\}\|$\)/``/' \ -e '/^\*.*``/s/^\*[[:space:]]*/- ``/')" assert "parse part 2 of exam failed" helpmsg="$(echo "$helpmsg" | sed '/^Examples:/,/^[[:space:]]*$/d')" assert "cut of help msg failed" fi #write t2t file cat < - ``--option`` text #-usageline -> usage: ``code`` #-extra empty line before new section to close itemize #-examplelines (^*) -> - ``line`` #-remove NEEDS and OPTINAL, ... line #-added newline before new option block echo -e "$helpmsg" | sed \ -e 's/^[[:space:]]*//' \ -e 's/[[:space:]]*$//' \ -e '/^-[^ ]/s/ \{2,\}/**\n/' \ -e '/^-[^ ].*\*\*/s/^/: **/' \ -e '/^\* /s/\( \{2\}\|$\)/``/' \ -e '/^\*.*``/s/^\*[[:space:]]*/- ``/' \ -e '/^\(NEEDS\|OPTIONAL\|USES\|PROVIDES\)/d' \ -e 's/^[A-Za-z]* options:/\n&/' assert "sed of options failed" if [ -n "$exam" ]; then cat < This Manual Page was converted from t2t format to the this format by [txt2tags http://txt2tags.org] ! The t2t file was extracted from '$prog --help' by ${0##*/} (version $version) = COPYRIGHT = Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. EOF csg-1.6_rc1/share/000077500000000000000000000000001357201131600140025ustar00rootroot00000000000000csg-1.6_rc1/share/CMakeLists.txt000066400000000000000000000001771357201131600165470ustar00rootroot00000000000000add_subdirectory(man) add_subdirectory(xml) add_subdirectory(doc) add_subdirectory(scripts/inverse) add_subdirectory(template) csg-1.6_rc1/share/doc/000077500000000000000000000000001357201131600145475ustar00rootroot00000000000000csg-1.6_rc1/share/doc/CMakeLists.txt000066400000000000000000000011561357201131600173120ustar00rootroot00000000000000find_package(Doxygen) if (DOXYGEN_FOUND) configure_file(Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile COMMENT "Build doxygen documentation") add_custom_target(html-csg DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html) if(NOT TARGET html) add_custom_target(html) endif() add_dependencies(html html-csg) set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES html) endif (DOXYGEN_FOUND) csg-1.6_rc1/share/doc/Doxyfile.in000066400000000000000000001742511357201131600166740ustar00rootroot00000000000000# Doxyfile 1.5.9 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @CMAKE_PROJECT_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @PROJECT_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @CMAKE_SOURCE_DIR@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */.git/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to FRAME, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. Other possible values # for this tag are: HIERARCHIES, which will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list; # ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which # disables this behavior completely. For backwards compatibility with previous # releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE # respectively. GENERATE_TREEVIEW = NONE # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Options related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO csg-1.6_rc1/share/man/000077500000000000000000000000001357201131600145555ustar00rootroot00000000000000csg-1.6_rc1/share/man/CMakeLists.txt000066400000000000000000000010421357201131600173120ustar00rootroot00000000000000if (TXT2TAGS_FOUND) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/votca-csg.man COMMAND ${TXT2TAGS_EXECUTABLE} -q -t man -i ${CMAKE_CURRENT_SOURCE_DIR}/votca-csg.t2t -o ${CMAKE_CURRENT_BINARY_DIR}/votca-csg.man COMMENT "Building votca-csg manpage") add_custom_target(votca-csg_manpage DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/votca-csg.man) add_dependencies(manpages votca-csg_manpage) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/votca-csg.man DESTINATION ${CMAKE_INSTALL_MANDIR}/man7 RENAME votca-csg.7) endif (TXT2TAGS_FOUND) csg-1.6_rc1/share/man/votca-csg.t2t000066400000000000000000000052521357201131600171020ustar00rootroot00000000000000votca-csg VOTCA Development Team %%mtime(%d/%m/%Y) %make the manpage type 7, txt2tags does 1 by default %!postproc(man): "^(\.TH.*) 1 " "\1 7 " = NAME = votca-csg - The VOTCA coarse-graining engine = DESCRIPTION = Versatile Object-oriented Toolkit for Coarse-graining Applications (VOTCA) is a package intended to reduce the amount of routine work when doing systematic coarse-graining of various systems. The core is written in C++. Iterative methods are implemented using bash + perl. Please visit the program site at __http://www.votca.org__. = SYNOPSIS = The following commands make up the votca-csg suite. Please refer to their individual man pages for further details. : **csg_boltzmann** Performs tasks that are needed for simple Boltzmann inversion in an interactive environment. : **csg_call** Calls script from the interactive framework for the user. : **csg_density** Calculates all kind of density profiles. : **csg_dlptopol** Create skeleton for dlpoly topology based on atomistic topology and a mapping file. : **csg_dump** Prints atoms that are read from a topology file to help debug atom naming. : **csg_fmatch** Performs force matching (also called //multiscale coarse-graining//). : **csg_gmxtopol** Create skeleton for gromacs topology based on atomistic topology and a mapping file. : **csg_imc_solver** Is internally called by inversion scripts to solve matrix equation for inverse Monte Carlo (imc). : **csg_inverse** Starts the script to run iterative Boltzmann inverse (ibi) or inverse Monte Carlo (imc), etc. : **csg_map** Map a reference trajectory to a coarse-grained trajectory. : **csg_property** Helper program called by inverse scripts to parse xml file. : **csg_resample** Changes grid + interval and interpolated any sort of table files. : **csg_reupdate** Reform the relative entropy update in inverse scripts. : **csg_stat** Calculates all kind of distribuions (bonded + non-bonded). = AUTHORS = Written and maintained by the VOTCA Development Team This Manual Page converted from t2t format to the this format by [txt2tags http://txt2tags.org] ! = COPYRIGHT = Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. csg-1.6_rc1/share/scripts/000077500000000000000000000000001357201131600154715ustar00rootroot00000000000000csg-1.6_rc1/share/scripts/inverse/000077500000000000000000000000001357201131600171445ustar00rootroot00000000000000csg-1.6_rc1/share/scripts/inverse/CMakeLists.txt000066400000000000000000000004241357201131600217040ustar00rootroot00000000000000file(GLOB VOTCA_SCRIPTS *.sh *.pl *.py) file(GLOB VOTCA_FILES csg_table *.pm *.m *.octave) install(FILES ${VOTCA_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/votca/scripts/inverse) install(PROGRAMS ${VOTCA_SCRIPTS} DESTINATION ${CMAKE_INSTALL_DATADIR}/votca/scripts/inverse) csg-1.6_rc1/share/scripts/inverse/CsgFunctions.pm000066400000000000000000000130251357201131600221100ustar00rootroot00000000000000package CsgFunctions; # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; require Exporter; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @EXPORT = qw(csg_function_help readin_table readin_data saveto_table saveto_table_err readin_table_err); sub csg_function_help() { print <){ $line++; ${$_[4]}.=$_ if (defined($_[4]) and (/^[#@]/)); next if /^[#@]/; # remove leading spacees for split $_ =~ s/^\s*//; next if /^\s*$/; my @parts=split(/\s+/); if ( $sloppy eq "yes" ) { defined($parts[1]) || die "readin_table: Not enought columns in line $line in file $_[0]\n"; $parts[$#parts+1] = "i"; } else { defined($parts[2]) || die "readin_table: Not enought columns in line $line in file $_[0], if you don't have flags in your table add --sloppy-tables option to csg_call\n"; ($parts[$#parts] =~ /[iou]/) || die "readin_table: Wrong flag($parts[$#parts]) for r=$parts[0] in file $_[0], if you don't have flags in your table add --sloppy-tables option to csg_call\n"; } #very trick array dereference (@) of pointer to an array $_[.] stored in an array $_ push(@{$_[1]},$parts[0]); push(@{$_[2]},$parts[1]); push(@{$_[3]},$parts[$#parts]); } close(TAB) || die "readin_table: could not close file $_[0]\n"; die "readin_table: 0 lines were read from $_[0]\n" if ($line==0); return $line; } sub readin_table_err($\@\@\@\@;\$) { defined($_[4]) || die "readin_table_err: Missing argument\n"; open(TAB,"$_[0]") || die "readin_table_err: could not open file $_[0]\n"; my $sloppy= $ENV{'VOTCA_TABLES_WITHOUT_FLAG'}; $sloppy="no" unless defined($sloppy); my $line=0; while (){ $line++; ${$_[5]}.=$_ if (defined($_[4]) and (/^[#@]/)); # remove leading spacees for split $_ =~ s/^\s*//; next if /^[#@]/; next if /^\s*$/; my @parts=split(/\s+/); if ( $sloppy eq "yes" ) { defined($parts[2]) || die "readin_table_err: Not enought columns in line $line in file $_[0]\n"; $parts[$#parts+1] = "i"; }else{ defined($parts[3]) || die "readin_table_err: Not enought columns in line $line in file $_[0], if you don't have flags in your table add --sloppy-tables option to csg_call\n"; ($parts[$#parts] =~ /[iou]/) || die "readin_table_err: Wrong flag($parts[$#parts]) for r=$parts[0] in file $_[0], if you don't have flags in your table add --sloppy-tables option to csg_call\n"; } #very trick array dereference (@) of pointer to an array $_[.] stored in an array $_ push(@{$_[1]},$parts[0]); push(@{$_[2]},$parts[1]); push(@{$_[3]},$parts[2]); push(@{$_[4]},$parts[$#parts]); } close(TAB) || die "readin_table_err: could not close file $_[0]\n"; die "readin_table_err: 0 lines were read from $_[0]\n" if ($line==0); return $line; } sub readin_data($$\@\@) { defined($_[3]) || die "readin_data: Missing argument\n"; open(TAB,"$_[0]") || die "readin_table: could not open file $_[0]\n"; my $line=0; my $column=int($_[1]); while (){ $line++; # remove leading spacees for split $_ =~ s/^\s*//; next if /^[#@]/; next if /^\s*$/; my @parts=split(/\s+/); defined($parts[1]) || die "readin_table: Not enought columns in line $line in file $_[0]\n"; die "readin_data: Can't read column $column\n" unless (defined($parts[$column])); #very trick array dereference (@) of pointer to an array $_[.] stored in an array $_ push(@{$_[2]},$parts[0]); push(@{$_[3]},$parts[$column]); } close(TAB) || die "readin_table: could not close file $_[0]\n"; return $line; } sub saveto_table($\@\@\@;$) { defined($_[3]) || die "saveto_table: Missing argument\n"; open(OUTFILE,"> $_[0]") or die "saveto_table: could not open $_[0] \n"; print OUTFILE "$_[4]" if (defined $_[4]); for(my $i=0;$i<=$#{$_[1]};$i++){ print OUTFILE "${$_[1]}[$i] ${$_[2]}[$i] ${$_[3]}[$i]\n"; } close(OUTFILE) or die "Error at closing $_[0]\n"; return 1; } sub saveto_table_err($\@\@\@\@;$) { defined($_[3]) || die "saveto_table: Missing argument\n"; open(OUTFILE,"> $_[0]") or die "saveto_table: could not open $_[0] \n"; print OUTFILE "$_[5]" if (defined $_[5]); for(my $i=0;$i<=$#{$_[1]};$i++){ print OUTFILE "${$_[1]}[$i] ${$_[2]}[$i] ${$_[3]}[$i] ${$_[4]}[$i]\n"; } close(OUTFILE) or die "Error at closing $_[0]\n"; return 1; } #important 1; csg-1.6_rc1/share/scripts/inverse/CsgSimplex.pm000066400000000000000000000217451357201131600215710ustar00rootroot00000000000000package CsgSimplex; # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; require Exporter; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @EXPORT = qw(csg_simplex_function_help readin_simplex_state saveto_simplex_state sort_simplex_table is_num replace_parameter_flag get_convergence_value remove_parameter_set calc_parameter_center linop_parameter); sub csg_simplex_function_help() { print <){ $line++; if (/^#State =\s*(\S*)/) { $state="$1"; next; } ${$_[3]}.=$_ if (defined($_[3]) and (/^[#@]/)); if (/^#Format\s*(.*)$/) { ${$_[4]}="$1" if defined($_[4]); } next if ($_ =~ /^[#@]/); $_ =~ s/^\s*//; # remove leading spacees for split next if /^\s*$/; my @parts=split(/\s+/); $parameters=$#parts unless ($parameters); die "readin_simplex_state: Number of parameters ($#parts) differ in line $line from previous lines ($parameters) of file $_[0]\n" if ($parameters != $#parts); push(@{$_[2]},\@parts); } close(TAB) || die "readin_simplex_state: could not close file $_[0]\n"; die "readin_simplex_state: 0 lines were read from $_[0]\n" if ($line==0); die "readin_simplex_state: could not read state from $_[0]\n" unless ($state); ${$_[1]}="$state"; return $line; } sub saveto_simplex_state($$\@;$) { defined($_[2]) || die "saveto_simplex_state: Missing argument\n"; open(OUTFILE,"> $_[0]") or die "saveto_simplex_state: could not open $_[0] \n"; print OUTFILE "$_[3]" if (defined $_[3]); print OUTFILE "#State = $_[1]\n"; my @simplex_table=@{$_[2]}; my $parameters=undef; #remember 2d arrays is a list of lists for (my $i=0;$i<=$#simplex_table;$i++){ $parameters=$#{$simplex_table[$i]} unless ($parameters); die "saveto_simplex_state: Number of parameters ($#{$simplex_table[$i]}) differ in set $i from previous lines ($parameters)" if ($parameters != $#{$simplex_table[$i]}); print OUTFILE "@{$simplex_table[$i]}\n"; } close(OUTFILE) or die "Error at closing $_[0]\n"; return 1; } sub sort_simplex_table(\@) { defined($_[0]) || die "sort_simplex_table: Missing argument\n"; my @simplex_table=@{$_[0]}; my $parameters=undef; my @index; #remember 2d arrays is a list of lists for (my $i=0;$i<=$#simplex_table;$i++){ $parameters=$#{$simplex_table[$i]} unless ($parameters); die "sort_simplex_table: Number of parameters ($#{$simplex_table[$i]}) differ in set $i from previous lines ($parameters)" if ($parameters != $#{$simplex_table[$i]}); push(@index,$i); is_num("$simplex_table[$i][-2]") || die "sort_simplex_table: second last value of parameter set $i is not a number\n"; die "sort_simplex_table: try set found!\n" if ($simplex_table[$i][-1] =~ /^try$/); } @index=sort { $simplex_table[$a][-2] <=> $simplex_table[$b][-2] } @index; my @sorted_table; for (my $i=0;$i<=$#index;$i++){ $sorted_table[$i]=$simplex_table[$index[$i]]; } @{$_[0]}=@sorted_table; return 1; } sub replace_parameter_flag(\@$$) { defined($_[2]) || die "replace_parameter_flag: Missing argument\n"; my @simplex_table=@{$_[0]}; for (my $i=0;$i<=$#simplex_table;$i++){ $simplex_table[$i][$#{$simplex_table[$i]}] =~ s/^$_[1]$/$_[2]/; } } sub is_num($) { defined($_[0]) || die "is_num: Missing argument\n"; use POSIX qw(strtod); my $str = shift; $str =~ s/^\s+//; $str =~ s/\s+$//; $! = 0; my($num, $unparsed) = strtod($str); if (($str eq '') || ($unparsed != 0) || $!) { return 0; } return 1; } # prototype is needed here as the function calls itself. sub get_convergence_value(\@$); sub get_convergence_value(\@$) { defined($_[1]) || die "get_convergence_value: Missing argument\n"; my @simplex_table=@{$_[0]}; if ($_[1] eq "lowest") { my $value=undef; for (my $i=0;$i<=$#simplex_table;$i++) { next if ($simplex_table[$i][-1] =~ /^try/); $value=$simplex_table[$i][-2] unless defined($value); $value=$simplex_table[$i][-2] if $value>$simplex_table[$i][-2] } return $value; } elsif ($_[1] eq "ihighest") { my $ivalue=undef; for (my $i=0;$i<=$#simplex_table;$i++) { next if ($simplex_table[$i][-1] =~ /^(try|tryold)$/); $ivalue=$i unless defined($ivalue); $ivalue=$i if $simplex_table[$ivalue][-2]<$simplex_table[$i][-2]; } return $ivalue; } elsif ($_[1] eq "highest") { my $i=get_convergence_value(@simplex_table,"ihighest"); return $simplex_table[$i][-2]; } elsif ($_[1] eq "second") { my $ivalue=get_convergence_value(@simplex_table,"ihighest"); # in case we do simplex on one parameter return $simplex_table[$ivalue][-2] if ($#simplex_table == 2); my $value=undef; for (my $i=0;$i<=$#simplex_table;$i++) { next if ($simplex_table[$i][-1] =~ /^(try|tryold)$/); next if ($i==$ivalue); $value=$simplex_table[$i][-2] unless defined($value); $value=$simplex_table[$i][-2] if $value<$simplex_table[$i][-2]; } return $value; } elsif ($_[1] =~ /^(try|tryold)$/) { my $value=undef; for (my $i=0;$i<=$#simplex_table;$i++) { if ( $simplex_table[$i][-1] =~ /^$_[1]$/ ) { die "get_convergence_value: Found two $_[1] value in parameter set\n" if defined($value); $value=$simplex_table[$i][-2]; } } die "get_convergence_value: Could not find any $_[1] value in paramter set\n" unless defined($value); return $value; } else { die "get_convergence_value: I don't know how to get value '$_[1]'\n"; } } sub remove_parameter_set(\@$) { defined($_[1]) || die "remove_parameter_set: Missing argument\n"; my @simplex_table=@{$_[0]}; my $value=undef; my @new_table; if ($_[1] =~ /^(try|tryold)$/) { for (my $i=0;$i<=$#simplex_table;$i++) { if ( $simplex_table[$i][-1] =~ /^$_[1]$/ ) { die "remove_parameter_set: Found two parameter set with flag '$_[1]'" if defined($value); $value=$i; } else { push(@new_table,$simplex_table[$i]); } } } elsif ($_[1] eq "highest") { $value=get_convergence_value(@simplex_table,"ihighest"); for (my $i=0;$i<=$#simplex_table;$i++) { push(@new_table,$simplex_table[$i]) unless ($i == $value); } } else { die "remove_parameter_set: I don't know how to remove value '$_[1]'\n"; } die "remove_parameter_set: Could not find a parameter set with flag '$_[1]'" unless defined($value); @{$_[0]}=@new_table; return @{$simplex_table[$value]}; } sub calc_parameter_center(\@){ defined($_[0]) || die "calc_parameter_center: Missing argument\n"; my @simplex_table=@{$_[0]}; my @center; sort_simplex_table(@simplex_table); for (my $j=0;$j<=$#{$simplex_table[0]};$j++) { if (is_num("$simplex_table[0][$j]")) { $center[$j]=0; } else { $center[$j]=$simplex_table[0][$j]; } } #mind the $i<$#simplex_table to skip the highest value for (my $i=0;$i<$#simplex_table;$i++) { die "calc_parameter_center: number of parameters (".($#{$simplex_table[$i]}-1).") of parameter set #".($i+1)." differs from the number of non-try sets - 1 (=".($#simplex_table)."). Expected $#{$simplex_table[$i]} non-try sets.\n" if (($#simplex_table+1) != $#{$simplex_table[$i]}); for (my $j=0;$j<=$#{$simplex_table[$i]};$j++) { if (is_num("$simplex_table[$i][$j]")) { $center[$j]+=$simplex_table[$i][$j]/$#simplex_table; } } } return @center; } sub linop_parameter(\@$\@\@) { defined($_[3]) || die "linop_parameter: Missing argument\n"; my @vec1=@{$_[0]}; my $scale=$_[1]; my @vec2=@{$_[2]}; die "linop_parameter: 1st ($#vec1) and 2nd vector ($#vec2) have different length\n" unless ($#vec1 = $#vec2); my @vec3=@{$_[3]}; my @vec4; die "linop_parameter: 1st ($#vec1) and 3rd vector ($#vec3) have different length\n" unless ($#vec1 = $#vec3); for (my $i=0;$i<=$#vec1;$i++) { if (is_num($vec1[$i])) { $vec4[$i]=$vec1[$i]+$scale*($vec2[$i]-$vec3[$i]); } else { $vec4[$i]=$vec1[$i]; } } $vec4[-1]="pending"; $vec4[-2]=0; return @vec4; } #important 1; csg-1.6_rc1/share/scripts/inverse/add_POT.pl000077500000000000000000000050541357201131600207620ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; ( my $progname = $0 ) =~ s#^.*/##; if (defined($ARGV[0])&&("$ARGV[0]" eq "--help")){ print <0.0001); die "Different start potential point $r_delta[0] $r_cur[0]\n" if (($r_delta[0]-$r_cur[0]) > 0.0001); die "Different end potential point \n" if ( $#r_cur != $#r_delta ); my $outfile="$ARGV[2]"; my @pot; my @flag; # TODO: think about addition rules # now I did it like that to always maintain interval of interest in all potentials # shount that just be a < instead of <= ?? for (my $i=0;$i<=$#r_cur;$i++){ if($flag_cur[$i] eq "u" || $flag_delta[$i] eq "u") { $pot[$i] = $pot_cur[$i]; # is already nan or we don't change $flag[$i] = "u"; } else { $pot[$i]=$pot_cur[$i]+$pot_delta[$i]; $flag[$i] = $flag_cur[$i]; } #if ($flag_cur[$i] eq "i"){ # if ($flag_delta[$i] eq "i"){ # $pot[$i]=$pot_cur[$i]+$pot_delta[$i]; # } else { # $pot[$i]=$pot_cur[$i]; # } # $flag[$i]="i"; #} else { # $pot[$i]="nan"; # $flag[$i]="u"; #} } saveto_table($outfile,@r_cur,@pot,@flag) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/add_pot_generic.sh000077500000000000000000000017331357201131600226150ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat <" "0"; then msg --color blue --to-stderr "Automatically setting begin time to 0, because CSG_RUNTEST was set" begin=0 fi echo "Running ${g_energy[@]}" #no critical here so that we can print the error output=$(echo Pressure | ${g_energy[@]} -b "${begin}" -s "${topol}" ${opts} 2>&1) ret="$?" echo "$output" | gromacs_log "${g_energy[@]} -b "${begin}" -s "${topol}" ${opts}" [[ $ret -eq 0 ]] || die "${0##*/}: '${g_energy[@]} -b "${begin}" -s "${topol}" ${opts}' failed" #the number pattern '-\?[0-9][^[:space:]]*[0-9]' is ugly, but it supports X X.X X.Xe+X Xe-X and so on #awk 'print $2' does not work for older version of g_energy as the format varies between #^Pressure XXX (bar) and ^Pressure (bar) XXX p_now=$(echo "$output" | sed -n 's/^Pressure[^-0-9]*\(\(-\?[0-9][^[:space:]]*[0-9]\|nan\)\)[[:space:]].*$/\1/p' ) || \ die "${0##*/}: sed grep of Pressure failed" [[ -z $p_now ]] && die "${0##*/}: Could not get pressure from simulation" [[ $p_now = nan && $(csg_get_property cg.inverse.gromacs.g_energy.pressure.allow_nan) = no ]] && \ die "${0##*/}: Pressure was nan, check your simulation (this usually means system has blow up -> use pre simulation)" echo "Pressure=${p_now}" > "$1" csg-1.6_rc1/share/scripts/inverse/calc_pressure_lammps.sh000077500000000000000000000022521357201131600237070ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat < 1 {avg += $1} END {printf "%.16f\n", avg/(NR-1)}' ${p_file}) || die "${0##*/}: pressure averaging failed" echo "Pressure=${p_now}" > "$1" csg-1.6_rc1/share/scripts/inverse/calc_rdf_generic.sh000077500000000000000000000075341357201131600227450ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat <" "0"; then msg --color blue --to-stderr "Automatically setting equi_time to 0, because CSG_RUNTEST was set" equi_time=0 fi first_frame="$(csg_get_property cg.inverse.$sim_prog.first_frame)" if [[ ${CSG_RUNTEST} ]] && csg_calc "$first_frame" ">" "0"; then msg --color blue --to-stderr "Automatically setting first_frame to 0, because CSG_RUNTEST was set" first_frame=0 fi with_errors=$(csg_get_property cg.inverse.$sim_prog.rdf.with_errors) if [[ ${with_errors} = "yes" ]]; then suffix="_with_errors" block_length=$(csg_get_property cg.inverse.$sim_prog.rdf.block_length) if [[ ${CSG_RUNTEST} ]] && csg_calc "$block_length" ">" "2"; then msg --color blue --to-stderr "Automatically setting block_length to 2, because CSG_RUNTEST was set" block_length=2 fi error_opts="--block-length ${block_length} --ext dist.block" else suffix="" fi tasks=$(get_number_tasks) #rdf calculation is maybe done already in a different interaction if is_done "rdf_calculation${suffix}"; then echo "rdf calculation is already done" else msg "Calculating rdfs with csg_stat using $tasks tasks" critical csg_stat --nt $tasks --options "$CSGXMLFILE" --top "$topol" --trj "$traj" --begin $equi_time --first-frame $first_frame ${error_opts} ${maps:+--cg ${maps}} mark_done "rdf_calculation${suffix}" fi if [[ ${with_errors} = "yes" ]]; then if ! is_done "${name}_rdf_average"; then for i in ${name}_*.dist.block; do [[ -f $i ]] || die "${0##*/}: Could not find ${name}_*.dist.block after running csg_sat, that usually means the blocksize (cg.inverse.$sim_prog.rdf.block_length) is too big." done msg "Calculating average rdfs and its errors for interaction $name" do_external table average --output ${name}.dist.new ${name}_*.dist.block mark_done "${name}_rdf_average" fi fi csg-1.6_rc1/share/scripts/inverse/calc_target_rdf_generic.sh000077500000000000000000000040441357201131600243040ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat <" "$limit" || touch 'stop' csg-1.6_rc1/share/scripts/inverse/csg_table000066400000000000000000000176271357201131600210270ustar00rootroot00000000000000# # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #general scripts tag file tag_file.sh dummy dummy dummy.sh #only here for building the manual (not actually used) functions common functions_common.sh csg master inverse.sh # BEGIN: these scripts have to be defined for each method # method initialization prepare ibi prepare_generic.sh prepare imc prepare_imc.sh prepare generic prepare_generic.sh prepare optimizer prepare_optimizer.sh prepare re prepare_re.sh prepare_single ibi prepare_generic_single.sh prepare_single imc prepare_generic_single.sh prepare_single optimizer prepare_optimizer_single.sh initstep ibi initialize_step_generic.sh initstep imc initialize_step_generic.sh initstep optimizer initialize_step_optimizer.sh initstep re initialize_step_re.sh # the update step # add up the potential # TODO: think about name add_pot, is other name maybe better add_pot ibi add_pot_generic.sh add_pot imc add_pot_generic.sh add_pot optimizer dummy.sh add_pot re dummy.sh # END: these scripts have to be defined for each method # pre update pre_update ibi dummy.sh pre_update imc dummy.sh pre_update optimizer dummy.sh pre_update re pre_update_re.sh # post update post_update ibi post_update_generic.sh post_update imc post_update_generic.sh post_update optimizer dummy.sh post_update re post_update_generic.sh post_update_single ibi post_update_generic_single.sh post_update_single imc post_update_generic_single.sh post_update_single re post_update_re_single.sh #post update scripts postupd scale postupd_scale.sh postupd pressure postupd_pressure.sh postupd lj postupd_addlj.sh postupd splinesmooth postupd_splinesmooth.sh postupd smooth postupd_smooth.sh postupd shift postadd_shift.sh postupd dummy postadd_dummy.sh postupd tag tag_file.sh postupd extrapolate postupd_extrapolate.sh postupd kbibi postupd_kbibi_correction.sh postupd cibi postupd_cibi_correction.sh # post add post add post_add.sh post add_single post_add_single.sh # post add scripts postadd tag tag_file.sh postadd dummy postadd_dummy.sh postadd copyback postadd_copyback.sh postadd compress postadd_compress.sh postadd convergence postadd_convergence.sh postadd acc_convergence postadd_acc_convergence.sh postadd shift postadd_shift.sh postadd overwrite postadd_overwrite.sh postadd plot postadd_plot.sh postadd average postadd_average.sh #convergence checks convergence_check default convergence_check_default.sh # table preparation resample target resample_target.sh # ibi specific stuff update ibi update_ibi.sh update ibi_single update_ibi_single.sh update ibi_pot update_ibi_pot.pl # imc specific stuff update imc update_imc.sh update imc_single update_imc_single.sh # optimzer(generic) stuff optimizer prepare_state optimizer_prepare_state.sh optimizer parameters_to_potential optimizer_parameters_to_potential.sh optimizer state_to_potentials optimizer_state_to_potentials.sh optimizer state_to_mapping optimizer_state_to_mapping.sh update optimizer update_optimizer.sh update optimizer_single update_optimizer_single.sh optimizer_target rdf optimizer_target_rdf.sh optimizer_target density optimizer_target_density.sh optimizer_target pressure optimizer_target_pressure.sh # simplex specific stuff simplex precede_state simplex_downhill_processor.pl # cma specific stuff cma precede_state cma_processor.py # relative entroy (re) specific stuff update re update_re.sh # recalculate reference calc target_rdf calc_target_rdf_generic.sh # pressure correction pressure_cor simple pressure_cor_simple.pl pressure_cor wjk pressure_cor_wjk.pl # lj addition compute_lj 12_6 lj_126.pl # kirkwood-buff correction kbibi ramp_correction kbibi_ramp_correction.pl calc kbint calc_kbint.sh # generic table manipulation table add add_POT.pl table integrate table_integrate.pl table extrapolate table_extrapolate.pl table merge merge_tables.pl table smooth table_smooth.pl table linearop table_linearop.pl #do not use table functional here as it needs gnuplot table dummy table_dummy.sh table get_value table_get_value.pl table switch_border table_switch_border.pl table compare table_combine.pl --die --op = table combine table_combine.pl table average table_average.sh table scale table_scale.pl table change_flag table_change_flag.sh table functional table_functional.sh # generic potential manipulation potential extrapolate potential_extrapolate.sh potential shift potential_shift.pl convert_potential tab table_to_tab.pl # generic distribution manipulation dist adjust dist_adjust.pl dist invert dist_boltzmann_invert.pl # error analysis tables jackknife tables_jackknife.pl # BEGIN: these scripts have to be defined for each simulation program # interface to gromacs initstep gromacs initialize_step_genericsim.sh run gromacs run_gromacs.sh clean gromacs clean_generic.sh presimulation gromacs run_gromacs.sh --pre pressure gromacs calc_pressure_gromacs.sh pressure lammps calc_pressure_lammps.sh rdf gromacs calc_rdf_generic.sh imc_stat gromacs imc_stat_generic.sh density gromacs calc_density_generic.sh # gromacs scripts specific stuff convert_potential gromacs potential_to_gromacs.sh convert_potentials gromacs potentials_to_generic.sh convert_potential xvg table_to_xvg.pl #function for gromacs functions gromacs functions_gromacs.sh # Interface to ESPResSo initstep espresso initialize_step_genericsim.sh run espresso run_genericsim.sh clean espresso clean_generic.sh rdf espresso calc_rdf_generic.sh imc_stat espresso imc_stat_generic.sh density espresso calc_density_generic.sh # ESPResSo scripts convert_potential espresso potential_to_generic.sh convert_potentials espresso potentials_to_generic.sh # function for ESPResSo functions espresso functions_genericsim.sh # lammps scripts convert_potential lammps potential_to_lammps.sh convert_potentials lammps potentials_to_generic.sh # interface to lammps initstep lammps initialize_step_genericsim.sh run lammps run_genericsim.sh clean lammps clean_generic.sh rdf lammps calc_rdf_generic.sh imc_stat lammps imc_stat_generic.sh density lammps calc_density_generic.sh # function for lammps functions lammps functions_genericsim.sh # espressopp scripts convert_potential espressopp potential_to_generic.sh convert_potentials espressopp potentials_to_generic.sh # interface to espressopp initstep espressopp initialize_step_genericsim.sh run espressopp run_genericsim.sh clean espressopp clean_generic.sh rdf espressopp calc_rdf_generic.sh imc_stat espressopp imc_stat_generic.sh density espressopp calc_density_generic.sh # function for espressopp functions espressopp functions_genericsim.sh # interface to dlpoly initstep dlpoly initialize_step_genericsim.sh run dlpoly run_genericsim.sh clean dlpoly clean_generic.sh rdf dlpoly calc_rdf_generic.sh imc_stat dlpoly imc_stat_generic.sh density dlpoly calc_density_generic.sh # function for dlpoly functions dlpoly functions_dlpoly.sh # dlpoly scripts convert_potential dlpoly potential_to_dlpoly.sh convert_potentials dlpoly potentials_to_dlpoly.sh # hoomd-blue scripts convert_potential hoomd-blue potential_to_generic.sh convert_potentials hoomd-blue potentials_to_generic.sh # interface to hoomd-blue initstep hoomd-blue initialize_step_genericsim.sh run hoomd-blue run_genericsim.sh clean hoomd-blue clean_generic.sh rdf hoomd-blue calc_rdf_generic.sh imc_stat hoomd-blue imc_stat_generic.sh density hoomd-blue calc_density_generic.sh # function for hoomd-blue functions hoomd-blue functions_genericsim.sh # END: these scripts have to be defined for each simulation program csg-1.6_rc1/share/scripts/inverse/dist_adjust.pl000077500000000000000000000040251357201131600220220ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2013 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; $_=$0; s#^.*/##; my $progname=$_; my $usage="Usage: $progname [OPTIONS] "; my $with_errors="no"; my $with_entropie="no"; my $kbT=undef; my $from="right"; my $spherical="no"; # read program arguments while ((defined ($ARGV[0])) and ($ARGV[0] =~ /^-./)) { if (($ARGV[0] !~ /^--/) and (length($ARGV[0])>2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")) { print <2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")) { print < go and implement it\n" unless (( "$type" eq "bond" ) or ("$type" eq "dihedral") or ("$type" eq "angle") or ("$type" eq "non-bonded")); } elsif ($ARGV[0] eq "--min"){ shift(@ARGV); $dist_min = shift(@ARGV); } else { die "Unknown option '".$ARGV[0]."' !\n"; } } die "2 parameters are necessary\n" if ($#ARGV<1); die "$progname: kbT not defined specify it with --kbT option\n" unless defined($kbT); use CsgFunctions; my $infile="$ARGV[0]"; my $outfile="$ARGV[1]"; my @x; my @dist; my @flag; (readin_table($infile,@x,@dist,@flag)) || die "$progname: error at readin_table\n"; my @pot; for (my $i=0;$i<=$#x;$i++){ if ($dist[$i]>$dist_min) { my $norm=1; if ( "$type" eq "bond" ) { $norm=$x[$i]*$x[$i]; } elsif ( "$type" eq "angle" ) { $norm=sin($x[$i]); } $pot[$i]=-$kbT*log($dist[$i]/$norm); } else { $pot[$i]="nan"; $flag[$i]="u"; } } #find a valid point my $valid_i=-1; for (my $i=0;$i<=$#pot;$i++){ if ($flag[$i] eq "i") { $valid_i=$i; last; } } die "All data points from file '$infile' are invalid after Boltzmann inversion, please check if your distribution is a valid dist.\n" if ($valid_i==-1); #set point at beginning to invalid my $first=undef; for (my $i=$valid_i;$i>=0;$i--){ if ($flag[$i] eq "u") { $pot[$i]=$pot[$i+1]; $flag[$i]="o"; $first=$i unless defined $first; } } $first=0 unless defined $first; #set point at end to invalid my $last=undef; for (my $i=$valid_i;$i<=$#pot;$i++){ if ($flag[$i] eq "u") { $pot[$i]=$pot[$i-1]; $flag[$i]="o"; $last=$i unless defined $last; } } $last=$#pot unless defined $last; my $n=10; my $valid=$last-$first+1; die "Only $valid points are valid after Boltzmann inversion from file '$infile', please check if your distribution is a valid dist.\n" if ($valid < $n); saveto_table($outfile,@x,@pot,@flag) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/dummy.sh000077500000000000000000000014551357201131600206430ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat <&4 echo -e "$*" >&2 else echo -e "${color}$*${off}" >&2 fi else [[ -z $* ]] && return if [[ -n ${CSGLOG} ]]; then echo -e "${color}$*${off}" >&3 echo -e "$*" else echo -e "${color}$*${off}" fi fi } export -f msg show_callstack() { #show the current callstack local space line if [[ -n $CSG_CALLSTACK ]]; then echo "$CSG_CALLSTACK" space="$(echo "$CSG_CALLSTACK" | sed -n '$s/[^[:space:]].*$/ /p')" else space="" fi [[ $0 = *"bash" ]] || echo "${space}${0} - linenumber ${BASH_LINENO[ $(( ${#FUNCNAME[@]} -2 ))]}" for ((c=${#FUNCNAME[*]}-1;c>0;c--)); do [[ ${FUNCNAME[$c]} = main ]] && continue #main is useless as the info was printed 2 lines above space+=" " if [[ $0 = *csg_call || $0 = *inverse.sh ]]; then echo "${space}${FUNCNAME[$c]} - linenumber ${BASH_LINENO[ $(( $c - 1 )) ]} in ${BASH_SOURCE[$c]}" else echo "${space}${FUNCNAME[$c]} - linenumber ${BASH_LINENO[ $(( $c - 1 )) ]} (see 'csg_call --cat function ${FUNCNAME[$c]}')" fi done [[ $1 = "--extra" ]] || return 0 shift for i in "$@"; do space+=" " echo "${space}${i} - linenumber ???" done } export -f show_callstack unset -f die die () { #make the iterative frame work stopp local pid pids c place #Output callstack to stderr in case die was executed in $( ) echo -e "\nCallstack:" >&2 show_callstack >&2 [[ -z $CSGLOG ]] && place="Details can be found above" || place="For details see the logfile $CSGLOG" msg --color red --to-stderr "$(csg_banner "ERROR:" "$@" "$place")" if [[ -n ${CSG_MASTER_PID} ]]; then #grabbing the pid group would be easier, but it would not work on AIX pid="$$" pids="$$" c=0 #find the parent of pid until we reach CSG_MASTER_PID until [[ ${CSG_MASTER_PID} -eq $pid ]]; do #get the parent pid using BSD style due to AIX pid=$(ps -o ppid= -p "$pid" 2>/dev/null) [[ -z $pid ]] && pids="0" && break #store them in inverse order to kill parents before the child pids="$pid $pids" ((c++)) #at max 10000 iterations if [[ $c -eq 10000 ]]; then #failback to default, see comment below pids="0" break fi done if [[ -n ${CSGLOG} ]]; then echo "${FUNCNAME[0]}: (called from $$) CSG_MASTER_PID is $CSG_MASTER_PID" >&2 echo "${FUNCNAME[0]}: pids to kill: $pids" >&2 fi kill $pids else #send kill signal to all process within the process groups kill 0 fi exit 1 } export -f die cat_external() { #takes a two tags and shows content of the according script local script script="$(source_wrapper $1 $2)" || die "${FUNCNAME[0]}: source_wrapper $1 $2 failed" if [[ $1 = "function" ]]; then type $2 | sed '1d' else cat "${script/ *}" fi } export -f cat_external do_external() { #takes two tags, find the according script and excute it local script tags quiet="no" ret [[ $1 = "-q" ]] && quiet="yes" && shift script="$(source_wrapper $1 $2)" || die "${FUNCNAME[0]}: source_wrapper $1 $2 failed" tags="$1 $2" [[ $1 != "function" && ! -x ${script/ *} ]] && die "${FUNCNAME[0]}: subscript '${script/ *}' (from tags $tags), is not executable! (Run chmod +x ${script/ *})" #print this message to stderr to allow $(do_external ) and do_external XX > [[ $quiet = "no" ]] && echo "Running subscript '${script##*/}${3:+ }${@:3}' (from tags $tags) dir ${script%/*}" >&2 # in debugmode we don't need to do anything special for $1 = function as set -x is already done if [[ -n $CSGDEBUG ]] && [[ -n "$(sed -n '1s@bash@XXX@p' "${script/ *}")" ]]; then CSG_CALLSTACK="$(show_callstack)" "${BASH}" -x $script "${@:3}" elif [[ -n $CSGDEBUG && -n "$(sed -n '1s@perl@XXX@p' "${script/ *}")" ]]; then local perl_debug="$(mktemp perl_debug.XXX)" ret PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2 LineInfo=$perl_debug" perl -dS $script "${@:3}" ret=$? cat "$perl_debug" 2>&1 [[ $ret -eq 0 ]] elif [[ $1 != "function" && -n "$(sed -n '1s@perl@XXX@p' "${script/ *}")" ]]; then CSG_CALLSTACK="$(show_callstack --extra "${script/ *}")" $script "${@:3}" else CSG_CALLSTACK="$(show_callstack)" $script "${@:3}" fi || die "${FUNCNAME[0]}: subscript" "$script ${*:3}" "(from tags $tags) failed" } export -f do_external critical() { #executes arguments as command and calls die if not succesful local quiet="no" [[ $1 = "-q" ]] && quiet="yes" && shift [[ -z $1 ]] && die "${FUNCNAME[0]}: missing argument" #print this message to stderr because $(critical something) is used very often [[ $quiet = "no" ]] && echo "Running critical command '$*'" >&2 "$@" || die "${FUNCNAME[0]}: '$*' failed" } export -f critical for_all (){ #do something for all interactions (1st argument) local bondtype ibondtype rbondtype bondtypes name interactions quiet="no" [[ $1 = "-q" ]] && quiet="yes" && shift [[ -z $1 || -z $2 ]] && die "${FUNCNAME[0]}: need at least two arguments" bondtypes="$1" shift interactions=( $(csg_get_interaction_property --all name) ) min=( $(csg_get_interaction_property --all min) ) [[ ${#min[@]} -ne ${#interactions[@]} ]] && die "${FUNCNAME[0]}: one interaction has no name or min" name=$(has_duplicate "${interactions[@]}") && die "${FUNCNAME[0]}: interaction name $name appears twice" for bondtype in $bondtypes; do #check that type is bonded or non-bonded is_part "$bondtype" "non-bonded bonded angle bond dihedral" || die "for_all: Argument 1 needs to be non-bonded, bonded, angle, bond or dihedral" [[ $quiet = "no" ]] && echo "For all $bondtype" >&2 #internal bondtype is_part "$bondtype" "angle bond dihedral bonded" && ibondtype="bonded" || ibondtype="non-bonded" interactions=( $(csg_get_property --allow-empty cg.$ibondtype.name) ) #filter me away for name in "${interactions[@]}"; do #check if interaction is actually angle, bond or dihedral if is_part "$bondtype" "angle bond dihedral"; then rbondtype=$(bondtype="$ibondtype" bondname="$name" csg_get_interaction_property bondtype) [[ $rbondtype = $bondtype ]] || continue fi #print this message to stderr to avoid problem with $(for_all something) [[ $quiet = no ]] && echo "for_all: run '$*' for interaction named '$name'" >&2 #we need to use bash -c here to allow things like $(csg_get_interaction_property name) in arguments #write variable defines in the front is better, that export #no need to run unset afterwards bondtype="$ibondtype" \ bondname="$name" \ CSG_CALLSTACK="$(show_callstack)" \ "${BASH}" -c "$*" || die "${FUNCNAME[0]}: ${BASH} -c '$*' failed for interaction named '$name'" done done } export -f for_all csg_get_interaction_property () { #gets an interaction property from the xml file, should only be called from inside a for_all loop or with --all option local ret allow_empty="no" for_all="no" xmltype while [[ $1 = --* ]]; do case $1 in --allow-empty) allow_empty="yes";; --all) for_all="yes";; *) die "${FUNCNAME[0]}: Unknow option '$1'";; esac shift done [[ -n $1 ]] || die "${FUNCNAME[0]}: Missing argument" if [[ $for_all = "yes" ]]; then [[ $1 = "bondtype" ]] && die "${FUNCNAME[0]}: --all + bondtype not implemented yet" local t for t in non-bonded bonded; do ret+=" $(csg_get_property --allow-empty "cg.$t.$1")" #filter me away done ret="$(echo "$ret" | trim_all)" [[ -z $ret ]] && die "${FUNCNAME[0]}: Not a single interaction has a value for the property $1" echo "$ret" return 0 fi #make these this case work even without name or type (called by csg_call) if [[ $1 = "name" ]]; then [[ -n $bondname ]] && echo "$bondname" && return 0 die "${FUNCNAME[0]}: bondname is undefined (when calling from csg_call set it by --ia-name option)" fi if [[ $1 = "bondtype" ]]; then #bondtype is special -> dirty hack - removed whenever issue 13 is fixed [[ -z "$bondtype" ]] && die "${FUNCNAME[0]}: bondtype is undefined (when calling from csg_call set it by --ia-type option)" #for_all notation for any kind of bonded interaction, find the real type if [[ $bondtype = "bonded" ]]; then [[ -z ${bondname} ]] && die "${FUNCNAME[0]}: bondtype 'bonded' needs a bondname (when calling from csg_call set it by --ia-name option) or change type to angle, bond or dihedral" [[ -n "$(type -p csg_property)" ]] || die "${FUNCNAME[0]}: Could not find csg_property" mapping="$(csg_get_property --allow-empty cg.inverse.map)" #make error message more useful [[ -z ${mapping} ]] && die "${FUNCNAME[0]}: bondtype 'bonded' needs a mapping file (cg.inverse.map in xml) to determine the actual bond type (when calling from csg_call better use --ia-type bond, angle or dihedral)" local map names=() ret= ret2 dup for map in ${mapping}; do [[ -f "$(get_main_dir)/$map" ]] || die "${FUNCNAME[0]}: Mapping file '$map' for bonded interaction not found in maindir" names+=( $(critical -q csg_property --file "$(get_main_dir)/$map" --path cg_molecule.topology.cg_bonded.*.name --print . --short) ) [[ -n ${names[@]} ]] && dup=$(has_duplicate "${names[@]}") && die "${FUNCNAME[0]}: cg_bonded name '$dup' appears twice in file(s) $mapping" ret2="$(critical -q csg_property --file "$(get_main_dir)/$map" --path cg_molecule.topology.cg_bonded.* --filter name="$bondname" --print . --with-path | trim_all)" ret2="$(echo "$ret2" | critical sed -n 's/.*cg_bonded\.\([^[:space:]]*\) .*/\1/p')" if [[ -n $ret2 ]]; then [[ -n $ret ]] && die "${FUNCNAME[0]}: Found cg_bonded type for name '$bondname' twice" ret="${ret2}" fi done [[ -z $ret ]] && die "${FUNCNAME[0]}: Could not find a bonded definition with name '$bondname' in the mapping file(s) '$mapping'. Make sure to use the same name in the settings file (or --ia-name when calling from csg_call) and the mapping file." echo "$ret" else echo "$bondtype" fi return 0 fi [[ -n "$CSGXMLFILE" ]] || die "${FUNCNAME[0]}: CSGXMLFILE is undefined (when calling from csg_call set it by --options option)" [[ -n $bondtype ]] || die "${FUNCNAME[0]}: bondtype is undefined (when calling from csg_call set it by --ia-type option)" [[ -n $bondname ]] || die "${FUNCNAME[0]}: bondname is undefined (when calling from csg_call set it by --ia-name option)" #map bondtype back to tags in xml file (for csg_call) case "$bondtype" in "non-bonded") xmltype="non-bonded";; "bonded"|"bond"|"angle"|"dihedral") xmltype="bonded";; *) msg "Unknown bondtype '$bondtype' - assume non-bonded" xmltype="non-bonded";; esac [[ -n "$(type -p csg_property)" ]] || die "${FUNCNAME[0]}: Could not find csg_property" #the --filter/--path(!=.) option will make csg_property fail if $1 does not exist #so no critical here ret="$(csg_property --file $CSGXMLFILE --short --path cg.${xmltype} --filter name=$bondname --print $1 | trim_all)" #overwrite with function call value [[ -z $ret && -n $2 ]] && ret="$2" [[ -z $ret ]] && echo "${FUNCNAME[0]}: No value for '$1' found in $CSGXMLFILE, trying ${VOTCA_CSG_DEFAULTS}" >&2 # if still empty fetch it from defaults file if [[ -z $ret && -f ${VOTCA_CSG_DEFAULTS} ]]; then ret="$(critical -q csg_property --file "${VOTCA_CSG_DEFAULTS}" --short --path cg.${xmltype}.$1 --print . | trim_all)" [[ $allow_empty = "yes" && -n "$res" ]] && msg "WARNING: '${FUNCNAME[0]} $1' was called with --allow-empty, but a default was found in '${VOTCA_CSG_DEFAULTS}'" #from time to time the default is only given in the non-bonded section [[ -z $ret ]] && ret="$(critical -q csg_property --file "${VOTCA_CSG_DEFAULTS}" --short --path cg.non-bonded.$1 --print . | trim_all)" [[ -n $ret ]] && echo "${FUNCNAME[0]}: value for '$1' from ${VOTCA_CSG_DEFAULTS}: $ret" >&2 fi [[ $allow_empty = "no" && -z $ret ]] && die "${FUNCNAME[0]}: Could not get '$1' for interaction with name '$bondname' from ${CSGXMLFILE} and no default was found in ${VOTCA_CSG_DEFAULTS}" [[ -z $ret ]] && echo "${FUNCNAME[0]}: returning emtpy value for '$1'" >&2 echo "${ret}" } export -f csg_get_interaction_property csg_get_property () { #get an property from the xml file local ret allow_empty if [[ $1 = "--allow-empty" ]]; then shift allow_empty="yes" else allow_empty="no" fi [[ -n $1 ]] || die "${FUNCNAME[0]}: Missing argument" [[ -n "$CSGXMLFILE" ]] || die "${FUNCNAME[0]}: CSGXMLFILE is undefined (when calling from csg_call set it by --options option)" [[ -n "$(type -p csg_property)" ]] || die "${FUNCNAME[0]}: Could not find csg_property" #csg_property only fails if xml file is bad otherwise result is empty #leave the -q here to avoid flooding with messages ret="$(critical -q csg_property --file "$CSGXMLFILE" --path ${1} --short --print . | trim_all)" #overwrite with function call value [[ -z $ret && -n $2 ]] && ret="$2" [[ -z $ret ]] && echo "${FUNCNAME[0]}: No value for '$1' found in $CSGXMLFILE, trying ${VOTCA_CSG_DEFAULTS}" >&2 #if still empty fetch it from defaults file if [[ -z $ret && -f ${VOTCA_CSG_DEFAULTS} ]]; then ret="$(critical -q csg_property --file "${VOTCA_CSG_DEFAULTS}" --path "${1}" --short --print . | trim_all)" [[ $allow_empty = "yes" && -n "$res" ]] && msg "WARNING: '${FUNCNAME[0]} $1' was called with --allow-empty, but a default was found in '${VOTCA_CSG_DEFAULTS}'" #avoid endless recursion [[ $1 = cg.inverse.program && -n $ret ]] && sim_prog="$ret" || \ sim_prog="$(csg_get_property cg.inverse.program)" #no problem to call recursively as sim_prog has a default if [[ -z $ret ]] && [[ $1 = *${sim_prog}* ]]; then local path=${1/${sim_prog}/sim_prog} ret="$(critical -q csg_property --file "${VOTCA_CSG_DEFAULTS}" --path "${path}" --short --print . | trim_all)" fi [[ -n $ret ]] && echo "${FUNCNAME[0]}: value for '$1' from ${VOTCA_CSG_DEFAULTS}: $ret" >&2 [[ $allow_empty = "yes" && -n "$res" ]] && msg "WARNING: '${FUNCNAME[0]} $1' was called with --allow-empty, but a default was found in '${VOTCA_CSG_DEFAULTS}'" fi [[ $allow_empty = "no" && -z $ret ]] && die "${FUNCNAME[0]}: Could not get '$1' from ${CSGXMLFILE} and no default was found in ${VOTCA_CSG_DEFAULTS}" [[ -z $ret ]] && echo "${FUNCNAME[0]}: returning emtpy value for '$1'" >&2 echo "${ret}" } export -f csg_get_property trim_all() { #make multiple lines into one and strip white space from beginning and the end, reads from stdin [[ -n "$(type -p tr)" ]] || die "${FUNCNAME[0]}: Could not find tr" tr '\n' ' ' | sed -e s'/^[[:space:]]*//' -e s'/[[:space:]]*$//' || die "${FUNCNAME[0]}: sed of argument $i failed" } export -f trim_all mark_done () { #mark a task (1st argument) as done in the restart file local file [[ -n $1 ]] || die "${FUNCNAME[0]}: Missing argument" file="$(get_restart_file)" is_done "$1" || echo "$1 done" >> "${file}" } export -f mark_done is_done () { #checks if something is already do in the restart file local file [[ -n $1 ]] || die "${FUNCNAME[0]}: Missing argument" file="$(get_restart_file)" [[ -f ${file} ]] || return 1 [[ -n "$(sed -n "/^$1 done\$/p" ${file})" ]] && return 0 return 1 } export -f is_done is_int() { #checks if all arguments are integers local i [[ -z $1 ]] && die "${FUNCNAME[0]}: Missing argument" for i in "$@"; do [[ -n $i && -z ${i//[0-9]} ]] || return 1 done return 0 } export -f is_int to_int() { #convert all given numbers to int using awk's int function local i [[ -z $1 ]] && die "${FUNCNAME[0]}: Missing argument" for i in "$@"; do is_num "$i" || die "${FUNCNAME[0]}: $i is not a number" awk -v x="$i" 'BEGIN{ print ( int(x) ) }' || die "${FUNCNAME[0]}: awk failed" done return 0 } export -f to_int is_part() { #checks if 1st argument is part of the set given by other arguments [[ -z $1 || -z $2 ]] && die "${FUNCNAME[0]}: Missing argument" [[ " ${@:2} " = *" $1 "* ]] } export -f is_part has_duplicate() { #check if one of the arguments is double local i j [[ -z $1 ]] && die "${FUNCNAME[0]}: Missing argument" for ((i=1;i<$#;i++)); do for ((j=i+1;j<=$#;j++)); do [[ ${!i} = ${!j} ]] && echo ${!i} && return 0 done done return 1 } export -f has_duplicate remove_duplicate() { #remove duplicates list of arguments local i j out=() c [[ -z $1 ]] && die "${FUNCNAME[0]}: Missing argument" for ((i=1;i<=$#;i++)); do c=0 for ((j=0;j<${#out[@]};j++)); do [[ ${!i} = ${out[j]} ]] && ((c++)) done [[ $c -eq 0 ]] && out+=( "${!i}" ) done echo "${out[@]}" } export -f remove_duplicate is_num() { #checks if all arguments are numbers local i res [[ -z $1 ]] && die "${FUNCNAME[0]}: Missing argument" for i in "$@"; do res=$(awk -v x="$i" 'BEGIN{ print ( x+0==x ) }') || die "${FUNCNAME[0]}: awk failed" [[ $res -eq 1 ]] || return 1 unset res done return 0 } export -f is_num get_stepname() { #get the dir name of a certain step number (1st argument) local name [[ -n $1 ]] || die "${FUNCNAME[0]}: Missing argument" if [[ $1 = "--trunc" ]]; then echo "step_" return 0 fi is_int "${1}" || die "${FUNCNAME[0]}: needs a int as argument, but got $1" name="$(printf step_%03i "$1")" [[ -z $name ]] && die "${FUNCNAME[0]}: Could not get stepname" echo "$name" } export -f get_stepname update_stepnames(){ #updated the current working step to a certain number (1st argument) local thisstep laststep nr [[ -n $1 ]] || die "${FUNCNAME[0]}: Missing argument" nr="$1" is_int "$nr" || die "${FUNCNAME[0]}: needs a int as argument, but got $nr" [[ -z $CSG_MAINDIR ]] && die "${FUNCNAME[0]}: CSG_MAINDIR is undefined" [[ -d $CSG_MAINDIR ]] || die "${FUNCNAME[0]}: $CSG_MAINDIR is not dir" thisstep="$(get_stepname $nr)" export CSG_THISSTEP="$CSG_MAINDIR/$thisstep" if [[ $nr -gt 0 ]]; then laststep="$(get_stepname $((nr-1)) )" export CSG_LASTSTEP="$CSG_MAINDIR/$laststep" fi } export -f update_stepnames get_current_step_dir() { #print the directory of the current step [[ -z $CSG_THISSTEP ]] && die "${FUNCNAME[0]}: \$CSG_THISSTEP is undefined (when calling from csg_call export it yourself)" if [[ $1 = "--no-check" ]]; then : else [[ -d $CSG_THISSTEP ]] || die "${FUNCNAME[0]}: $CSG_THISSTEP is not dir" fi echo "$CSG_THISSTEP" } export -f get_current_step_dir get_last_step_dir() { #print the directory of the last step [[ -z $CSG_LASTSTEP ]] && die "${FUNCNAME[0]}: CSG_LASTSTEP is undefined (when calling from csg_call export it yourself)" [[ -d $CSG_LASTSTEP ]] || die "${FUNCNAME[0]}: $CSG_LASTSTEP is not dir" echo "$CSG_LASTSTEP" } export -f get_last_step_dir get_main_dir() { #print the main directory [[ -z $CSG_MAINDIR ]] && die "${FUNCNAME[0]}: CSG_MAINDIR is defined" [[ -d $CSG_MAINDIR ]] || die "${FUNCNAME[0]}: $CSG_MAINDIR is not dir" echo "$CSG_MAINDIR" } export -f get_main_dir get_current_step_nr() { #print the main directory local name nr name=$(get_current_step_dir) nr=$(get_step_nr $name) echo "$nr" } export -f get_current_step_nr get_step_nr() { #print the number of a certain step directory (1st argument) local nr trunc trunc=$(get_stepname --trunc) [[ -n $1 ]] || die "${FUNCNAME[0]}: Missing argument" nr=${1##*/} nr=${nr#$trunc} #convert to base 10 and cut leading zeros nr=$((10#$nr)) is_int "$nr" || die "${FUNCNAME[0]}: Could not fetch step nr, got $nr" echo "$nr" } export -f get_step_nr cp_from_main_dir() { #copy something from the main directory critical pushd "$(get_main_dir)" if [[ $1 = "--rename" ]]; then shift [[ $# -eq 2 && -n $1 && -n $2 ]] || die "${FUNCNAME[0]}: with --rename option has to be called with exactly 2 (non-empty) arguments" echo "cp_from_main_dir: '$1' to '$2'" critical cp $1 "$(dirs -l +1)/$2" else echo "cp_from_main_dir: '$@'" critical cp $@ "$(dirs -l +1)" fi critical popd } export -f cp_from_main_dir cp_from_last_step() { #copy something from the last step if [[ $1 = "--rename" ]]; then shift [[ $# -eq 2 && -n $1 && -n $2 ]] || die "${FUNCNAME[0]}: with --rename option has to be called with exactly 2 (non-empty) arguments" echo "cp_from_last_step: '$1' to '$2'" critical pushd "$(get_last_step_dir)" critical cp $1 "$(dirs -l +1)/$2" critical popd else echo "cp_from_last_step: '$@'" critical pushd "$(get_last_step_dir)" critical cp $@ "$(dirs -l +1)" critical popd fi } export -f cp_from_last_step get_time() { #gives back current time in sec from 1970 date +%s || die "${FUNCNAME[0]}: date +%s failed" } export -f get_time get_number_tasks() { #get the number of possible tasks from the xml file or determine it automatically under some systems local tasks tasks="$(csg_get_property cg.inverse.simulation.tasks)" [[ $tasks = "auto" ]] && tasks=0 is_int "$tasks" || die "${FUNCNAME[0]}: cg.inverse.simulation.tasks needs to be a number or 'auto', but I got $(csg_get_property cg.inverse.simulation.tasks)" if [[ $tasks -eq 0 ]]; then #auto-detect if [[ -r /proc/cpuinfo ]]; then #linux tasks=$(sed -n '/processor/p' /proc/cpuinfo | sed -n '$=') elif [[ -x /usr/sbin/sysctl ]]; then #mac os tasks=$(/usr/sbin/sysctl -n hw.ncpu) elif [[ -x /usr/sbin/lsdev ]]; then #AIX tasks=$(/usr/sbin/lsdev | sed -n '/Processor/p' | sed -n '$=') fi is_int "${tasks}" || tasks=1 #failback in case we got non-int fi if [[ ${CSG_NUM_THREADS} ]]; then is_int "${CSG_NUM_THREADS}" || die "${FUNCNAME[0]}: value of CSG_NUM_THREADS needs to be a number, but I got ${CSG_NUM_THREADS}" msg --color blue --to-stderr "${FUNCNAME[0]}: Overwriting cg.inverse.simulation.tasks with '${CSG_NUM_THREADS}'" tasks="${CSG_NUM_THREADS}" fi echo "$tasks" } export -f get_number_tasks get_table_comment() { #get comment lines from a table and add common information, which include the git id and other information local version co [[ -n "$(type -p csg_call)" ]] || die "${FUNCNAME[0]}: Could not find csg_call" version="$(csg_call --version)" || die "${FUNCNAME[0]}: csg_call --version failed" echo "Created on $(date) by $USER@$HOSTNAME" echo "called from $version" | sed "s/csg_call/${0##*/}/" [[ -n "${CSGXMLFILE}" ]] && echo "settings file: '$(globalize_file "${CSGXMLFILE}")'" echo "working directory: $PWD" if [[ -f $1 ]]; then co=$(sed -n 's/^[#@][[:space:]]*//p' "$1") || die "${FUNCNAME[0]}: sed failed" [[ -n $co ]] && echo "Comments from $(globalize_file $1):\n$co" fi } export -f get_table_comment csg_inverse_clean() { #clean out the main directory local i files log t [[ -n $1 ]] && t="$1" || t="30" log="$(csg_get_property cg.inverse.log_file 2>/dev/null)" echo -e "So, you want to clean?\n" echo "I will remove:" files="$(ls -d done ${log} $(get_stepname --trunc)* *~ 2>/dev/null)" if [[ -z $files ]]; then echo "Nothing to clean" else msg --color red $files msg --color blue "\nCTRL-C to stop it" for ((i=$t;i>0;i--)); do echo -n "$i " sleep 1 done rm -rf $files msg --color green "\n\nDone, hope you are happy now" fi } export -f csg_inverse_clean check_path_variable() { #check if a variable contains only valid paths local old_IFS dir [[ -z $1 ]] && die "${FUNCNAME[0]}: Missing argument" for var in "$@"; do [[ -z $var ]] && continue old_IFS="$IFS" IFS=":" for dir in ${!var}; do [[ -z $dir ]] && continue [[ $dir = *votca* ]] || continue #to many error otherwise [[ -d $dir ]] || die "${FUNCNAME[0]}: $dir from variable $var is not a directory" done IFS="$old_IFS" done } export -f check_path_variable add_to_csgshare() { #added an directory to the csg internal search directories local dir end="no" [[ $1 = "--at-the-end" ]] && end="yes" && shift [[ -z $1 ]] && die "${FUNCNAME[0]}: Missing argument" for dirlist in "$@"; do old_IFS="$IFS" IFS=":" for dir in $dirlist; do #dir maybe contains $PWD or something eval dir="$dir" [[ -d $dir ]] || die "${FUNCNAME[0]}: Could not find scriptdir $dir" dir="$(globalize_dir "$dir")" if [[ $end = "yes" ]]; then export CSGSHARE="${CSGSHARE}${CSGSHARE:+:}$dir" export PERL5LIB="${PERL5LIB}${PERL5LIB:+:}$dir" else export CSGSHARE="$dir${CSGSHARE:+:}$CSGSHARE" export PERL5LIB="$dir${PERL5LIB:+:}$PERL5LIB" fi done IFS="$old_IFS" done check_path_variable CSGSHARE PERL5LIB } export -f add_to_csgshare globalize_dir() { #convert a local directory to a global one [[ -z $1 ]] && die "${FUNCNAME[0]}: missing argument" [[ -d $1 ]] || die "${FUNCNAME[0]}: '$1' is not a dir" cd "$1" pwd } export -f globalize_dir globalize_file() { #convert a local file name to a global one [[ -z $1 ]] && die "${FUNCNAME[0]}: missing argument" [[ -f $1 ]] || die "${FUNCNAME[0]}: '$1' is not a file" local dir [[ ${1%/*} = ${1} ]] && dir="." || dir="${1%/*}" echo "$(globalize_dir "$dir")/${1##*/}" } export -f globalize_file source_function() { #source an extra function file local function_file [[ -n $1 ]] || die "${FUNCNAME[0]}: Missing argument" function_file=$(source_wrapper functions $1) || die "${FUNCNAME[0]}: source_wrapper functions $1 failed" source ${function_file} || die "${FUNCNAME[0]}: source ${function_file} failed" } export -f source_function csg_banner() { #print a big banner local i l=0 list=() [[ -z $1 ]] && return 0 for i in "$@"; do while [[ -n $i && -z ${i/*\\n*} ]]; do list[$l]="${i%%\\n*}" ((l++)) i="${i#*\\n}" done list[$l]=$i ((l++)) done l="1" for i in "${list[@]}"; do [[ ${#l} -lt ${#i} ]] && l="${i}" done echo "####${l//?/#}" echo "# ${l//?/ } #" for i in "${list[@]}"; do printf "# %-${#l}s #\n" "$i" done echo "# ${l//?/ } #" echo "####${l//?/#}" } export -f csg_banner csg_calc() { #simple calculator, a + b, ... local res ret=0 err="1e-2" [[ -z $1 || -z $2 || -z $3 ]] && die "${FUNCNAME[0]}: Needs 3 arguments, but got '$*'" is_num "$1" || die "${FUNCNAME[0]}: First argument of csg_calc should be a number, but got '$1'" is_num "$3" || die "${FUNCNAME[0]}: Third argument of csg_calc should be a number, but got '$3'" [[ -n "$(type -p awk)" ]] || die "${FUNCNAME[0]}: Could not find awk" #we use awk -v because then " 1 " or "1\n" is equal to 1 case "$2" in "+"|"-"|'*'|"/"|"^") res="$(awk -v x="$1" -v y="$3" "BEGIN{print ( x $2 y ) }")" || die "${FUNCNAME[0]}: awk -v x='$1' -v y='$3' 'BEGIN{print ( x $2 y ) }' failed" true;; '>'|'<' ) res="$(awk -v x="$1" -v y="$3" "BEGIN{print ( x $2 y )}")" || die "${FUNCNAME[0]}: awk -v x='$1' -v y='$3' 'BEGIN{print ( x $2 y )}' failed" #awk return 1 for true and 0 for false, shell exit codes are the other way around ret="$((1-$res))" #return value matters res="" true;; "="|"==") #this is really tricky... case x=0,y=0 is catched by (x==y) after that |x-y|/max(|x|,|y|) will work expect for x,y beginng close to zero res="$(awk -v x="$1" -v y="$3" -v e="$err" \ 'function max(x,y){return (x>y)?x:y;} function abs(x){return (x<0)?-x:x;} BEGIN{if (x==y){print 1;}else{if (abs(x-y)&1 4>&2 >> "$CSGLOG" 2>&1 echo -e "\n\n#################################" echo "# Appending to existing logfile #" echo -e "#################################\n\n" msg --color blue "Appending to existing logfile ${CSGLOG##*/}" else exec 3>&1 4>&2 >> "$CSGLOG" 2>&1 msg "For a more verbose log see: ${CSGLOG##*/}" fi } export -f enable_logging get_restart_file() { #print the name of the restart file to use local file file="$(csg_get_property cg.inverse.restart_file)" [[ -z ${file/*\/*} ]] && die "${FUNCNAME[0]}: cg.inverse.restart_file has to be a local file with slash '/'" echo "$file" } export -f get_restart_file check_for_obsolete_xml_options() { #check xml file for obsolete options local i for i in cg.inverse.mpi.tasks cg.inverse.mpi.cmd cg.inverse.parallel.tasks cg.inverse.parallel.cmd \ cg.inverse.gromacs.mdrun.bin cg.inverse.espresso.bin cg.inverse.scriptdir cg.inverse.gromacs.grompp.topol \ cg.inverse.gromacs.grompp.index cg.inverse.gromacs.g_rdf.topol cg.inverse.convergence_check \ cg.inverse.convergence_check_options.name_glob cg.inverse.convergence_check_options.limit \ cg.inverse.espresso.table_end cg.inverse.gromacs.traj_type cg.inverse.gromacs.topol_out \ cg.inverse.espresso.blockfile cg.inverse.espresso.blockfile_out cg.inverse.espresso.n_steps \ cg.inverse.espresso.exclusions cg.inverse.espresso.debug cg.inverse.espresso.n_snapshots \ cg.non-bonded.inverse.espresso.index1 cg.non-bonded.inverse.espresso.index2 cg.inverse.espresso.success \ cg.inverse.espresso.scriptdir cg.non-bonded.inverse.post_update_options.kbibi.type \ cg.inverse.imc.numpy.bin cg.inverse.imc.octave.bin cg.inverse.imc.matlab.bin cg.inverse.imc.solver \ cg.non-bonded.inverse.imc.reg \ ; do [[ -z "$(csg_get_property --allow-empty $i)" ]] && continue #filter me away new="" case $i in cg.inverse.mpi.tasks|cg.inverse.parallel.tasks) new="cg.inverse.simulation.tasks";; cg.inverse.gromacs.mdrun.bin|cg.inverse.espresso.bin) new="${i/bin/command}";; cg.inverse.scriptdir) new="${i/dir/path}";; cg.inverse.gromacs.grompp.index) new="${i/.grompp}";; cg.inverse.gromacs.grompp.topol) new="cg.inverse.gromacs.topol_in";; cg.inverse.gromacs.g_rdf.topol) new="${i/g_}";; cg.inverse.gromacs.topol_out) new="${i/_out}";; cg.inverse.gromacs.traj_type) new="";; cg.inverse.convergence_check) new="${i}.type";; cg.inverse.convergence_check_options.limit) new="cg.inverse.convergence_check.limit";; cg.non-bonded.inverse.imc.reg) new="cg.inverse.imc..reg";; esac [[ -n $new ]] && new="has been renamed to $new" || new="has been removed" die "${FUNCNAME[0]}: The xml option $i $new\nPlease remove the obsolete options from the xmlfile" done } export -f check_for_obsolete_xml_options command_not_found_handle() { #print and error message if a command or a function was not found die "Command/function $1 not found (when calling from csg_call you might need to add --simprog option or set cg.inverse.program in the xml file)" } export -f command_not_found_handle #in bash4 this is not needed, but for older bash we add add a failback from most important simulation functions for i in simulation_finish checkpoint_exist get_simulation_setting; do eval $i\(\) { command_not_found_handle $i\; } eval export -f $i done unset i csg-1.6_rc1/share/scripts/inverse/functions_dlpoly.sh000077500000000000000000000040161357201131600230770ustar00rootroot00000000000000#!/bin/bash # # Copyright 2009-2013 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat <gromacs-2016.3 allows to disable frame count output, e.g. "Reading frame ..." export GMX_TRAJECTORY_IO_VERBOSITY=0 get_simulation_setting() { #gets a parameter (1st argument) from gromacs mdp file (default 2nd parameter) local res if [[ $1 = "--file" ]]; then mdp="$2" shift 2 else mdp="$(csg_get_property cg.inverse.gromacs.mdp)" fi [[ -z $1 ]] && die "${FUNCNAME[0]}: Missing argument (property)" [[ -f $mdp ]] || die "${FUNCNAME[0]}: Could not read setting file '$mdp'" #1. strip comments #2. get important line #3. remove leading and tailing spaces res="$(sed -e '/^[[:space:]]*;/d' -e 's#;.*$##' "$mdp" | \ sed -n -e "s#^[[:space:]]*$1[[:space:]]*=\(.*\)\$#\1#p" | \ sed -e 's#^[[:space:]]*##' -e 's#[[:space:]]*$##')" || \ die "${FUNCNAME[0]}: sed failed" [[ -z $res && -z $2 ]] && die "${FUNCNAME[0]}: could not fetch $1 from $mdp and no default given, please add it in there" [[ -n $res ]] && echo "$res" || echo "$2" } export -f get_simulation_setting check_temp() { #compares k_B T in xml with temp in mpd file local kbt kbt2 temp t [[ "$(csg_get_property cg.inverse.gromacs.temp_check)" = "no" ]] && return 0 #kbt in energy unit kbt="$(csg_get_property cg.inverse.kBT)" temp="$(get_simulation_setting "ref[_-]t")" for t in $temp; do #0.00831451 is k_b in gromacs untis see gmx manual chapter 2 kbt2=$(csg_calc "$t" "*" 0.00831451) csg_calc "$kbt" "=" "$kbt2" || die "${FUNCNAME[0]}: cg.inverse.kBT ($kbt) in xml seetings file differs from 0.00831451*ref_t ($t from $temp)\n\ To disable this check set cg.inverse.gromacs.temp_check to 'no'" done return 0 } export -f check_temp simulation_finish() { #checks if simulation is finished local traj confout traj=$(csg_get_property cg.inverse.gromacs.traj) confout="$(csg_get_property cg.inverse.gromacs.conf_out)" [[ $1 = "--no-traj" ]] && [[ -f $confout ]] && return 0 [[ -f $traj ]] && [[ -f $confout ]] && return 0 return 1 } export -f simulation_finish checkpoint_exist() { #check if a checkpoint exists local checkpoint checkpoint="$(csg_get_property cg.inverse.gromacs.mdrun.checkpoint)" [[ -f $checkpoint ]] && return 0 [[ $(csg_get_property cg.inverse.gromacs.pre_simulation) = "yes" && -f pre_simulation/$checkpoint ]] && return 0 return 1 } export -f checkpoint_exist calc_begin_time() { #return the max of dt*frames and eqtime local dt equi_time first_frame dt=$(get_simulation_setting dt) first_frame="$(csg_get_property cg.inverse.gromacs.first_frame)" equi_time="$(csg_get_property cg.inverse.gromacs.equi_time)" t1=$(csg_calc "$dt" "*" "$first_frame") csg_calc "$t1" '>' "$equi_time" && echo "$t1" || echo "$equi_time" } export -f calc_begin_time calc_end_time() { #return dt * nsteps local dt steps dt=$(get_simulation_setting dt) steps=$(get_simulation_setting nsteps) csg_calc "$dt" "*" "$steps" } export -f calc_end_time gromacs_log() { #redirect stdin to a separate gromacs log file, 1st argument can be the name of the command to echo if redirection takes place local log log2 log="$(csg_get_property --allow-empty cg.inverse.gromacs.log)" if [[ -z $log ]]; then [[ ${CSG_RUNTEST} ]] && tee >(cat - >&4) || cat return $? fi log="${log##*/}" log2="$(csg_get_property cg.inverse.log_file)" log2="${log2##*/}" [[ $log = $log2 ]] && die "${FUNCNAME}: cg.inverse.gromacs.log is equal cg.inverse.log_file" [[ -n $* ]] && echo "Sending output of '$*' to $log (also look for errors there)" || echo "Sending stdin to $log (also look for errors there)" [[ ${CSG_RUNTEST} ]] && tee >(cat - >&4) || cat >> "$log" return $? } export -f gromacs_log csg-1.6_rc1/share/scripts/inverse/imc_stat_generic.sh000077500000000000000000000045351357201131600230110ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat <" "0"; then msg --color blue --to-stderr "Automatically setting equi_time to 0, because CSG_RUNTEST was set" equi_time=0 fi first_frame="$(csg_get_property cg.inverse.$sim_prog.first_frame)" if [[ ${CSG_RUNTEST} ]] && csg_calc "$first_frame" ">" "0"; then msg --color blue --to-stderr "Automatically setting first_frame to 0, because CSG_RUNTEST was set" first_frame=0 fi tasks=$(get_number_tasks) msg "Calculating IMC statistics using $tasks tasks" if is_done "imc_analysis"; then echo "IMC analysis is already done" else #copy+resample all target dist in $this_dir for_all "non-bonded bonded" do_external resample target '$(csg_get_interaction_property inverse.target)' '$(csg_get_interaction_property name).dist.tgt' critical csg_stat --do-imc --options "$CSGXMLFILE" --top "$topol" --trj "$traj" \ --begin $equi_time --first-frame $first_frame --nt $tasks mark_done "imc_analysis" fi csg-1.6_rc1/share/scripts/inverse/initialize_step_generic.sh000077500000000000000000000021411357201131600243710ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat <2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")){ print <0.0001); die "Different start potential point \n" if (($r_aim[0]-$r_cur[0]) > 0.0001); die "Different end potential point \n" if ( $#r_aim != $#r_cur ); my $j=0; my $avg_int=0; for (my $i=0;$i<=$#r_aim;$i++){ if (($r_aim[$i]>=$int_start) && ($r_aim[$i]<=$int_stop)) { $avg_int+=$kbint_cur[$i]-$kbint_aim[$i]; $j++; } } $avg_int/=$j; my $comment="#$progname: avg_int($int_start:$int_stop)=$avg_int ramp_factor=$ramp_factor r_ramp=$r_ramp\n"; my @dpot; my @flag; for (my $i=0;$i<=$#r_aim;$i++){ if ($r_aim[$i]> $r_ramp) { $dpot[$i]=0; #beyond r_ramp correction is 0 } else { $dpot[$i]=($avg_int*$ramp_factor*(1.0-($r_aim[$i]/$r_ramp)))*$kbt; } $flag[$i]="i"; } my $outfile="$ARGV[2]"; saveto_table($outfile,@r_aim,@dpot,@flag,$comment) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/lj_126.pl000077500000000000000000000031231357201131600205000ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; ( my $progname = $0 ) =~ s#^.*/##; if (defined($ARGV[0])&&("$ARGV[0]" eq "--help")){ print <0.0){ $pot[$i]=$c12/(($r[$i])**12) - $c6/(($r[$i])**6); } else { $pot[$i]=1.0E20; # very large number } $flag[$i]="i"; } saveto_table($outfile,@r,@pot,@flag,$comment) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/merge_tables.pl000077500000000000000000000065131357201131600221420ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; $_=$0; s#^.*/##; my $progname=$_; my $usage="Usage: $progname [OPTIONS] "; #Defaults my $noflags='no'; my $novalues='no'; my $withflag=undef; while ((defined ($ARGV[0])) and ($ARGV[0] =~ /^-./)) { if (($ARGV[0] !~ /^--/) and (length($ARGV[0])>2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")) { print < -1; $withflag = $ARGV[0]; } else { die "Unknown option '".$ARGV[0]."' !\n"; } shift(@ARGV); } #Print usage die "missing parameters\n$usage\n" unless $#ARGV > 1; use CsgFunctions; my $src="$ARGV[0]"; my $dst="$ARGV[1]"; my $out="$ARGV[2]"; print "tables $src $dst $out\n"; my @r_src; my @val_src; my @flag_src; my $comments1; (readin_table($src,@r_src,@val_src,@flag_src,$comments1)) || die "$progname: error at readin_table\n"; my @r_dst; my @val_dst; my @flag_dst; my $comments2; (readin_table($dst,@r_dst,@val_dst,@flag_dst,$comments2)) || die "$progname: error at readin_table\n"; my $idst=0; for(my $i=0; $i<=$#r_src; $i++) { # skip if flag does not match if($withflag) { if(!($flag_src[$i] =~ m/[$withflag]/)) { next; } } # advance in dst till same r while($r_dst[$idst] < $r_src[$i] - 1e-15) { $idst++; if ($idst > $#r_dst) { die "merge_tables.pl: destination table is too short"; } } my $tmp= $r_src[$i]-$r_dst[$idst]; die "error: grid mismatch" if(abs($r_dst[$idst] - $r_src[$i]) > 1e-15); if($novalues eq 'no') { $val_dst[$idst] = $val_src[$i]; } if($noflags eq 'no') { $flag_dst[$idst] = $flag_src[$i]; } } my $comments="# $progname: merged $src with $dst to $out\n"; $comments.="$comments1" if (defined($comments1)); $comments.="$comments2" if (defined($comments2)); saveto_table($out,@r_dst,@val_dst,@flag_dst,$comments) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/optimizer_parameters_to_potential.sh000077500000000000000000000040411357201131600265300ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat < "$1" echo "#Interactions: ${names}" >> "$1" echo "#Method: ${otype}" >> "$1" echo "#State = Initialization" >> $1 echo "#Format $parameters conv flag" >> "$1" #added conv=0 and flag=pending to all lines critical paste "${liste[@]}" | critical sed -e 's/$/ 0 pending/' >> "$1" #cma converts initial values to first population if [[ $otype = cma ]]; then tmpfile="$(critical mktemp "$1.XXX")" eps="$(csg_get_property cg.inverse.optimizer.cma.eps)" critical mv "$1" "$tmpfile" do_external cma precede_state --eps "$eps" "$tmpfile" "$1" fi csg-1.6_rc1/share/scripts/inverse/optimizer_state_to_mapping.sh000077500000000000000000000042051357201131600251430ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat < "$output" parameters="$(sed -n "${line}p" "$input")" for_all "non-bonded bonded" do_external optimizer parameters_to_potential "$parameters" csg-1.6_rc1/share/scripts/inverse/optimizer_target_density.sh000077500000000000000000000041471357201131600246400ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2016 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat < "${name}.density.conv" csg-1.6_rc1/share/scripts/inverse/optimizer_target_pressure.sh000077500000000000000000000030771357201131600250320ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat < use pre simulation)" p_now="${p_undef}" fi p_target="$(csg_get_interaction_property inverse.p_target)" critical awk -v x="$p_now" -v y="$p_target" 'BEGIN{print sqrt((x-y)^2)}' > "${name}.pressure.conv" csg-1.6_rc1/share/scripts/inverse/optimizer_target_rdf.sh000077500000000000000000000046351357201131600237360ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat < "${name}.rdf.conv" else do_external table combine --sum --op d "${name}.dist.tgt" "${name}.dist.new" > "${name}.rdf.conv" fi csg-1.6_rc1/share/scripts/inverse/post_add.sh000077500000000000000000000015011357201131600212750ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat <> "${name}.aconv" csg-1.6_rc1/share/scripts/inverse/postadd_average.sh000077500000000000000000000052231357201131600226350ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat <=0;step_i++)); do step_dir="$(get_stepname $step_nr)" if [[ -f $(get_main_dir)/$step_dir/${name}.${dist}.cur ]]; then tables[$step_i]="$(get_main_dir)/$step_dir/${name}.${dist}.cur" fi ((step_nr--)) done # compute the average if more than one tables found if [[ ${#tables[@]} -gt 1 ]]; then do_external table average --output ${name}.${dist}.avg "${tables[@]}" else # copy the single table to *.avg critical cp ${tables[0]} ${name}.${dist}.avg fi fi done csg-1.6_rc1/share/scripts/inverse/postadd_compress.sh000077500000000000000000000023721357201131600230600ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2014 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat < ${name}.${dist}.conv wdiff=$(csg_calc "$weight" "*" "${diff}") echo "Convergence of $dist for ${name} was ${diff} and has weight $weight, so difference is $wdiff" sum=$(csg_calc $sum + $wdiff) done echo "$sum" > ${name}.conv csg-1.6_rc1/share/scripts/inverse/postadd_copyback.sh000077500000000000000000000017111357201131600230140ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat <> gnuplot_pipe.log [[ $REPLY = "exit" ]] && break fi done | $gnuplot $opts & while true; do if [[ -z $(ps -o pid= -p "${CSG_MASTER_PID}") ]]; then echo "exit" > $(get_main_dir)/gnuplot_pipe rm -rf gnuplot_pipe gnuplot_pipe.log gnuplot_pipe.lock exit fi sleep 1 #lowers the load done & sleep 1 #wait for gnuplot_pipe cd - > /dev/null ) 7> $(get_main_dir)/gnuplot_pipe.lock #gnuplot is in laststep, move to current one echo "cd '$PWD'" > $(get_main_dir)/gnuplot_pipe || die "piping to gnuplot_pipe failed" #name pipe accept only one command at the time, for i in $(cat ); do echo $i > pipe; done would do the same echo "load '$(get_main_dir)/$script'" > $(get_main_dir)/gnuplot_pipe || die "piping to gnuplot_pipe failed" else [[ -z $(type -p killall) ]] && die "${0##*/}: could not find killall needed to kill gnuplot" killall $what_to_kill $gnuplot $opts "$(get_main_dir)/$script" || true #exit code not always clear fi csg-1.6_rc1/share/scripts/inverse/postadd_shift.sh000077500000000000000000000017701357201131600223430ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2013 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat <" "${max}" && die "${0##*/}: 'inverse.post_update_options.kbibi.stop'(${int_stop}) is bigger than max (${max}) for interaction '$name'" ramp_factor=$(csg_get_interaction_property inverse.post_update_options.kbibi.factor); is_num "${ramp_factor}" || die "${0##*/}: interaction property 'inverse.post_update_options.kbibi.factor', should be a number, but found '${ramp_factor}'" r_ramp=$(csg_get_interaction_property --allow-empty inverse.post_update_options.kbibi.r_ramp) do_external kbibi ramp_correction "${name}.kbint.tgt" "${name}.kbint.new" "${tmpfile}" "${kBT}" "$min:$step:${r_ramp:-$max}" "${int_start}:${int_stop}" "${ramp_factor}" comment="$(get_table_comment ${tmpfile})" tmpfile2=$(critical mktemp ${name}.kbibi.resample.XXX) critical csg_resample --in "${tmpfile}" --out "${tmpfile2}" --grid $min:$step:$max --comment "$comment" do_external table add "$1" "${tmpfile2}" "$2" else echo "No kbibi correction for interaction ${name}" do_external postupd dummy "$1" "$2" fi csg-1.6_rc1/share/scripts/inverse/postupd_pressure.sh000077500000000000000000000066311357201131600231370ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat < $tmpfile spmin=$(sed -n -e '1p' $tmpfile | awk '{print $1}') spmax=$(sed -n -e '$p' $tmpfile | awk '{print $1}') spstep=$(csg_get_interaction_property inverse.post_update_options.splinesmooth.step) comment="$(get_table_comment)" critical csg_resample --in $tmpfile --out "$2" --grid $min:$step:$max --type cubic --fitgrid $spmin:$spstep:$spmax --comment "$comment" csg-1.6_rc1/share/scripts/inverse/potential_extrapolate.sh000077500000000000000000000067631357201131600241260ustar00rootroot00000000000000#!/bin/bash # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # show_help () { cat <2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")){ print < \n" if ($#ARGV<1); use CsgFunctions; my $infile="$ARGV[0]"; my $outfile="$ARGV[1]"; # read in the current dpot my @r; my @dpot; my @flag; my $comments; (readin_table($infile,@r,@dpot,@flag,$comments)) || die "$progname: error at readin_table\n"; my $zero=undef; if ( "$type" eq "non-bonded" ) { $zero=$dpot[$#r]; } elsif (( "$type" eq "bond" ) or ("$type" eq "dihedral") or ("$type" eq "angle") or ("$type" eq "bonded")) { for(my $i=0; $i<=$#r; $i++) { $zero=$dpot[$i] if (($flag[$i] =~ /[i]/) and not defined($zero)); $zero=$dpot[$i] if (($flag[$i] =~ /[i]/) and ($dpot[$i]<$zero)); } die "No valid value found in $infile" unless defined($zero); } else{ die "$progname: Unsupported type of interatction: $type -> go and implement it\n"; } # shift potential by $zero for(my $i=0; $i<=$#r; $i++) { $dpot[$i] -= $zero; } # save to file saveto_table($outfile,@r,@dpot,@flag,$comments) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/potential_to_dlpoly.sh000077500000000000000000000117101357201131600235670ustar00rootroot00000000000000#!/bin/bash # # Copyright 2009-2018 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat < "${OUT}" #max 80 chars # see dlpoly manual ngrid = int(cut/delta) + 4 table_grid="$(($table_grid+4))" # nm -> Angs bin_size1="$(csg_calc "$bin_size" "*" 10)" table_end1="$(csg_calc "$table_end" "*" 10)" echo "$bin_size1 $table_end1 $table_grid" >> "${OUT}" fi elif [[ $bondtype = "bond" ]]; then OUT="TABBND" table_end="$(csg_get_property cg.inverse.dlpoly.bonds.table_end)" table_grid="$(csg_get_property cg.inverse.dlpoly.bonds.table_grid)" bin_size="$(csg_calc "$table_end" "/" $table_grid)" # make sure the TAB* file is removed externally if [[ ! -f "${OUT}" ]]; then echo "# Table for dlpoly from VOTCA with love" > "${OUT}" #max 80 chars # nm -> Angs table_end1="$(csg_calc "$table_end" "*" 10)" echo "# $table_end1 $table_grid" >> "${OUT}" fi elif [[ $bondtype = "angle" ]]; then OUT="TABANG" table_end="3.14159265359" table_grid="$(csg_get_property cg.inverse.dlpoly.angles.table_grid)" bin_size="$(csg_calc "$table_end" "/" $table_grid)" # make sure the TAB* file is removed externally if [[ ! -f "${OUT}" ]]; then echo "# Table for dlpoly from VOTCA with love" > "${OUT}" #max 80 chars echo "# $table_grid" >> "${OUT}" fi elif [[ $bondtype = "dihedral" ]]; then OUT="TABDIH" table_zero="-3.14159265359" table_end="3.14159265359" table_grid="$(csg_get_property cg.inverse.dlpoly.dihedrals.table_grid)" bin_size="$(csg_calc "$table_end" "-" $table_zero)" bin_size="$(csg_calc "$bin_size" "/" $table_grid)" # make sure the TAB* file is removed externally if [[ ! -f "${OUT}" ]]; then echo "# Table for dlpoly from VOTCA with love" > "${OUT}" #max 80 chars echo "# $table_grid" >> "${OUT}" fi else die "${0##*/}: conversion of ${bondtype} interaction to generic tables is not implemented yet!" fi # Yes, the dlpoly table starts at ${bin_size} table_begin="$(csg_calc "$table_zero" "+" $bin_size)" #keep the grid for now, so that extrapolate can calculate the right mean comment="$(get_table_comment)" smooth2="$(critical mktemp ${trunc}.pot.extended.XXXXX)" critical csg_resample --in ${input} --out "${smooth2}" --grid "${table_zero}:${step}:${table_end}" --comment "$comment" extrapolate="$(critical mktemp ${trunc}.pot.extrapolated.XXXXX)" do_external potential extrapolate --type "$bondtype" "${smooth2}" "${extrapolate}" smooth="$(critical mktemp ${trunc}.pot.smooth.XXXXX)" deriv="$(critical mktemp ${trunc}.pot.deriv.XXXXX)" critical csg_resample --in ${extrapolate} --out "${smooth}" --der "${deriv}" --grid "${table_begin}:${bin_size}:${table_end}" --comment "$comment" #shift does not change derivative tshift="$(critical mktemp ${trunc}.pot.shift.XXXXX)" do_external potential shift --type "$bondtype" "${smooth}" "${tshift}" do_external convert_potential tab --header dlpoly --type "${bondtype}" "${tshift}" "${deriv}" "${output}" if [[ -f $OUT ]]; then echo "Appending $output to $OUT" if [[ $bondtype = "non-bonded" ]]; then #votca non-bonded types might not correspond to dl_poly's internal types, only use a failback header="$(csg_get_interaction_property --allow-empty dlpoly.header)" [[ -z ${header} ]] && header="$(csg_get_interaction_property type1) $(csg_get_interaction_property type2)" echo "${header}" >> "$OUT" else header="$(csg_get_interaction_property dlpoly.header)" # an empty line must precede each data block (for another bond type), then the bond type (two atom types) follow echo "" >> "$OUT" echo "# ${header}" >> "$OUT" fi cat "${output}" >> "$OUT" fi csg-1.6_rc1/share/scripts/inverse/potential_to_generic.sh000077500000000000000000000057661357201131600237160ustar00rootroot00000000000000#!/bin/bash # # Copyright 2009-2018 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat < cg.inverse.gromacs.table_end ($tablend)" max="$(csg_get_interaction_property max)" rvdw="$(get_simulation_setting rvdw)" csg_calc "$max" ">" "$rvdw" && die "${0##*/}: rvdw ($rvdw) is smaller than max ($max)" [[ -z $tablend ]] && tablend=$(csg_calc "$rlist" + "$tabext") elif [[ -z $tablend ]]; then die "${0##*/}: cg.inverse.gromacs.table_end was not defined in xml seeting file" fi elif [[ $tabtype = "bond" ]]; then tablend="$(csg_get_property cg.inverse.gromacs.table_end)" elif [[ $tabtype = "angle" ]]; then tablend=180 elif [[ $tabtype = "dihedral" ]]; then zero="-180" tablend=180 else die "${0##*/}: Unknown interaction type $tabtype" fi [[ $step ]] || step=$(csg_get_interaction_property step) gromacs_bins="$(csg_get_property cg.inverse.gromacs.table_bins)" comment="$(get_table_comment $input)" if [[ $tabtype = "angle" || $tabtype = "dihedral" ]] && [[ $r2d != 1 ]]; then scale="$(critical mktemp ${trunc}.pot.scale.XXXXX)" do_external table linearop --on-x "${input}" "${scale}" "$r2d" "0" step=$(csg_calc $r2d "*" $step) else scale="${input}" fi #keep the grid for now, so that extrapolate can calculate the right mean smooth="$(critical mktemp ${trunc}.pot.smooth.XXXXX)" critical csg_resample --in ${scale} --out "$smooth" --grid "${zero}:${step}:${tablend}" extrapol="$(critical mktemp ${trunc}.pot.extrapol.XXXXX)" do_external potential extrapolate ${clean:+--clean} --type "$tabtype" "${smooth}" "${extrapol}" interpol="$(critical mktemp ${trunc}.pot.interpol.XXXXX)" critical csg_resample --in "${extrapol}" --out "$interpol" --grid "${zero}:${gromacs_bins}:${tablend}" --comment "$comment" if [[ $do_shift = "yes" ]]; then tshift="$(critical mktemp ${trunc}.pot.shift.XXXXX)" do_external potential shift --type "$tabtype" "${interpol}" "${tshift}" else tshift="$interpol" fi potmax="$(csg_get_property --allow-empty cg.inverse.gromacs.pot_max)" do_external convert_potential xvg ${potmax:+--max} ${potmax} --type "${xvgtype}" "${tshift}" "${output}" if [[ $clean ]]; then rm -f "${smooth}" "${interpol}" "${extrapol}" "${tshift}" [[ ${input} = ${scale} ]] || rm -f "${scale}" fi csg-1.6_rc1/share/scripts/inverse/potential_to_lammps.sh000077500000000000000000000121261357201131600235570ustar00rootroot00000000000000#!/bin/bash # # Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # show_help () { cat <$p_target){ $pref=-0.1*$kBT; } else { $pref=0.1*$kBT; } #Determine pressure factor my $p_factor=($p_now-$p_target)*$scale_factor; $p_factor=-$p_factor if $p_factor<0; #Only use pressure factor if not too big #max is 0.1kbT $pref*=$p_factor if $p_factor<1; my @r; my @pot; my @flag; my $outfile="$ARGV[1]"; my $comment="#$progname: p_now=$p_now, p_target=$p_target, prefactor=$pref\n"; for(my $i=$min/$delta_r;$i<=$max/$delta_r;$i++){ $r[$i]=$i*$delta_r; $pot[$i]=$pref*(1-$r[$i]/$max); $flag[$i]="i"; } saveto_table($outfile,@r,@pot,@flag,$comment) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/pressure_cor_wjk.pl000077500000000000000000000053641357201131600231020ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; ( my $progname = $0 ) =~ s#^.*/##; if (defined($ARGV[0])&&("$ARGV[0]" eq "--help")){ print < 0.1*$kBT){ if ($pref >0){ $pref=0.1*$kBT; }else{ $pref=-0.1*$kBT; } } $pref=$pref*$scale_factor; print "Pressure correction factor: A=$pref\n"; # my $prefile="${name}.pressure.prefactor"; # saveto_table($prefile,$pref) || die "$progname: error at save table\n"; my @r; my @pot; my @flag; my $outfile="$ARGV[1]"; my $comment="#$progname: p_now=$p_now, p_target=$p_target, prefactor=$pref\n"; for(my $i=$min/$delta_r;$i<=$max/$delta_r;$i++){ $r[$i]=$i*$delta_r; $pot[$i]=$pref*(1-$r[$i]/$max); $flag[$i]="i"; } saveto_table($outfile,@r,@pot,@flag,$comment) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/resample_target.sh000077500000000000000000000042121357201131600226600ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat <> "${mdp_x}" msg --color blue --to-stderr "Automatically added 'cutoff-scheme = Group' to ${mdp_x}, tabulated interactions only work with Group cutoff-scheme!" fi critical ${grompp[@]} -n "${index_x}" -f "${mdp_x}" -p "$topol_in_x" -o "${dir}/$tpr" -c "${conf_x}" ${grompp_opts} 2>&1 | gromacs_log "${grompp[@]}" -n "${index_x}" -f "${mdp_x}" -p "$topol_in_x" -o "${dir}/$tpr" -c "${conf_x}" -pe "${grompp_opts}" # a bit hacky but we have no better solution yet critical cp table*.xvg ./${dir} done else #support for older mdp file, cutoff-scheme = Verlet is default for >=gmx-5 now, but does not work with tabulated interactions #XXX is returned if cutoff-scheme is not in mdp file if [[ $(get_simulation_setting "cutoff[-_]scheme" XXX) = XXX ]]; then echo "cutoff-scheme = Group" >> $mdp msg --color blue --to-stderr "Automatically added 'cutoff-scheme = Group' to $mdp, tabulated interactions only work with Group cutoff-scheme!" fi #see can run grompp again as checksum of tpr does not appear in the checkpoint critical ${grompp[@]} -n "${index}" -f "${mdp}" -p "$topol_in" -o "$tpr" -c "${conf}" ${grompp_opts} 2>&1 | gromacs_log "${grompp[@]} -n "${index}" -f "${mdp}" -p "$topol_in" -o "$tpr" -c "${conf}" ${grompp_opts}" [[ -f $tpr ]] || die "${0##*/}: gromacs tpr file '$tpr' not found after runing grompp" fi mdrun="$(csg_get_property cg.inverse.gromacs.mdrun.command)" #no check for mdrun, because mdrun_mpi could maybe exist only computenodes if [[ ${CSG_MDRUN_CMD} ]]; then msg --color blue --to-stderr "Overwriting cg.inverse.gromacs.mdrun.command ('${mdrun}') with '${CSG_MDRUN_CMD}'" mdrun="${CSG_MDRUN_CMD}" fi if [[ -n $CSGENDING ]]; then #seconds left for the run wall_h=$(( $CSGENDING - $(get_time) )) #convert to hours wall_h=$(csg_calc $wall_h / 3600 ) echo "${0##*/}: Setting $mdrun maxh option to $wall_h (hours)" mdrun_opts="-cpi $checkpoint -maxh $wall_h ${mdrun_opts}" else echo "${0##*/}: No walltime defined, so no time limitation given to $mdrun" fi #handling of bonded tables if [[ ${mdrun_opts} != *tableb* ]]; then tables= for i in table_[abd][0-9]*.xvg; do [[ -f $i ]] && tables+=" $i" done if [[ -n ${tables} ]]; then msg --color blue --to-stderr "Automatically added '-tableb${tables} to mdrun options (add -tableb option to cg.inverse.gromacs.mdrun.opts yourself if this is wrong)" mdrun_opts+=" -tableb${tables}" fi fi critical $mdrun -s "${tpr}" -c "${confout}" -o "${traj%.*}".trr -x "${traj%.*}".xtc ${multidir:+-multidir} "${multidir[@]}" ${mdrun_opts} ${CSG_RUNTEST:+-v} 2>&1 | gromacs_log "$mdrun -s "${tpr}" -c "${confout}" -o "${traj%.*}".trr -x "${traj%.*}".xtc ${multdir:+-multidir} "${multidir[@]}" ${mdrun_opts}" if [[ ${multidir} ]]; then for dir in "${multidir[@]}"; do [[ ! -f ${dir}/${confout} ]] || [[ -z "$(critical sed -n '/[nN][aA][nN]/p' ${dir}/${confout})" ]] || die "${0##*/}: There is a nan in '${dir}/${confout}', this seems to be wrong." done else [[ ! -f ${confout} ]] || [[ -z "$(critical sed -n '/[nN][aA][nN]/p' ${confout})" ]] || die "${0##*/}: There is a nan in '${confout}', this seems to be wrong." fi if [[ ${multidir} ]]; then #for simulation_finish(), confout isn't used anywhere else. [[ -f ${confout} ]] || echo "Dummy file created by ${0##*/}" > "${confout}" if [[ ${mdrun_opts} = *-replex* ]]; then # for simulation_finish(), user has to tell imc, rdf, re updater what traj to use. [[ -f ${traj} ]] || echo "Dummy file created by ${0##*/}" > "${traj}" else trjcat=( $(csg_get_property cg.inverse.gromacs.trjcat.bin) ) [[ -n "$(type -p ${trjcat[0]})" ]] || die "${0##*/}: trjcat binary '${trjcat[0]}' not found" trjs=() for dir in "${multidir[@]}"; do trjs+=( "${dir}/${traj}" ) done critical ${trjcat[@]} -f "${trjs[@]}" -o "${traj}" -cat fi fi csg-1.6_rc1/share/scripts/inverse/simplex_downhill_processor.pl000077500000000000000000000125261357201131600251720ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; ( my $progname = $0 ) =~ s#^.*/##; if (defined($ARGV[0])&&("$ARGV[0]" eq "--help")){ print < $second_highest ) { $next_state="Contraction"; if ($try > $highest ) { remove_parameter_set(@simplex_table,"try"); } else { replace_parameter_flag(@simplex_table,"try","complete"); remove_parameter_set(@simplex_table,"highest"); } } else { #$try is between $lowest and $second_highest $next_state="Reflection"; replace_parameter_flag(@simplex_table,"try","complete"); remove_parameter_set(@simplex_table,"highest"); } } elsif ($state eq "Expansion") { $next_state="Reflection"; my $tryold=get_convergence_value(@simplex_table,"tryold"); if ($try < $tryold) { #tryold is the reflection point from before remove_parameter_set(@simplex_table,"tryold"); replace_parameter_flag(@simplex_table,"try","complete"); remove_parameter_set(@simplex_table,"highest"); } else { remove_parameter_set(@simplex_table,"try"); replace_parameter_flag(@simplex_table,"tryold","complete"); remove_parameter_set(@simplex_table,"highest"); } } elsif ($state eq "Contraction") { if ($try < $highest) { replace_parameter_flag(@simplex_table,"try","complete"); remove_parameter_set(@simplex_table,"highest"); $next_state="Reflection"; } else { $next_state="Reduction"; remove_parameter_set(@simplex_table,"try"); } } elsif ($state eq "Reduction") { replace_parameter_flag(@simplex_table,"try","complete"); $next_state="Reflection"; }else { die "$progname: Unknown state '$state'\n"; } if ($next_state eq "Reflection") { sort_simplex_table(@simplex_table); my @center_parameter=calc_parameter_center(@simplex_table); my @highest_parameter=@{$simplex_table[$#simplex_table]}; my @try_paramter=linop_parameter(@center_parameter,$alpha,@center_parameter,@highest_parameter); push(@simplex_table,\@try_paramter); } elsif ($next_state eq "Expansion") { my @tryold_parameter=remove_parameter_set(@simplex_table,"tryold"); #this should not go into the center sort_simplex_table(@simplex_table); my @center_parameter=calc_parameter_center(@simplex_table); my @highest_parameter=@{$simplex_table[$#simplex_table]}; my @try_paramter=linop_parameter(@center_parameter,$gamma,@center_parameter,@highest_parameter); push(@simplex_table,\@try_paramter,\@tryold_parameter); } elsif ($next_state eq "Contraction") { sort_simplex_table(@simplex_table); my @center_parameter=calc_parameter_center(@simplex_table); my @highest_parameter=@{$simplex_table[$#simplex_table]}; my @try_paramter=linop_parameter(@highest_parameter,$rho,@center_parameter,@highest_parameter); push(@simplex_table,\@try_paramter); } elsif ($next_state eq "Reduction") { sort_simplex_table(@simplex_table); my @lowest_parameter=@{$simplex_table[0]}; for (my $i=1; $i<=$#simplex_table;$i++) { my @try_paramter=linop_parameter(@lowest_parameter,$sigma,@{$simplex_table[$i]},@lowest_parameter); $simplex_table[$i]=\@try_paramter; } }else { die "$progname: Unknown state '$next_state'\n"; } print "Preparing $next_state with parameters ($parameter_names):\n"; for (my $i=0;$i<=$#simplex_table;$i++){ print "@{$simplex_table[$i]}\n"; } (saveto_simplex_state($ARGV[1],$next_state,@simplex_table,$comments)) || die "$progname: error at readin_simplex_table\n"; csg-1.6_rc1/share/scripts/inverse/skeleton.pl000077500000000000000000000020171357201131600213300ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; ( my $progname = $0 ) =~ s#^.*/##; if (defined($ARGV[0])&&("$ARGV[0]" eq "--help")){ print <&2; exit 1; } #check for VOTCASHARE [[ -n ${VOTCASHARE} ]] || die "Error: VOTCASHARE not definded" [[ -d ${VOTCASHARE} ]] || die "VOTCASHARE '$VOTCASHARE' is not a dir" [[ -d ${VOTCASHARE}/scripts/inverse ]] || die "\$VOTCASHARE/scripts/inverse is not found. Is VOTCASHARE set corectly?" [[ -f ${VOTCASHARE}/scripts/inverse/inverse.sh ]] || die "Could not find inverse.sh, \$VOTCASHARE/scripts/inverse seem to point to the wrong place!" [[ -f ${VOTCASHARE}/scripts/inverse/functions_common.sh ]] || die "Could not find default common framework functions (functions_common.sh)" source "${VOTCASHARE}/scripts/inverse/functions_common.sh" || exit 1 #this is needed by die later export CSG_MASTER_PID="$$" export CSG_MAINDIR="$PWD" if [[ -n ${VOTCA_CSG_DEFAULTS} ]]; then [[ -f ${VOTCA_CSG_DEFAULTS} ]] || die "Could not find ${VOTCA_CSG_DEFAULTS}! Is VOTCA_CSG_DEFAULTS set corectly?" else export VOTCA_CSG_DEFAULTS="${VOTCASHARE}/xml/csg_defaults.xml" [[ -f ${VOTCA_CSG_DEFAULTS} ]] || die "Could not find ${VOTCA_CSG_DEFAULTS}! Is VOTCASHARE ($VOTCASHARE) set corectly? Hint: When overwriting VOTCASHARE you need to overwrite VOTCA_CSG_DEFAULTS as well." fi #do no overwrite CSGSHARE stuff set by user from the outside add_to_csgshare --at-the-end "${VOTCASHARE}/scripts/inverse" csg-1.6_rc1/share/scripts/inverse/table_average.sh000077500000000000000000000064541357201131600222750ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # show_help () { cat < $t [[ -z $l ]] && l=$(critical sed -n '$=' $t) [[ $l -eq $(critical sed -n '$=' $t) ]] || die "Number of lines (after comments have been striped) mismatches in $f from $1" tables[$c]="$t" ((c++)) done t=$(critical mktemp "table_all.XXXX") critical paste "${tables[@]}" > "${t}" #no critical here to avoid huge error message awk -v c1="$colx" -v c2="$coly" -v s="$cols" ' function isnum(x){return(x==x+0)} { sum=0; sum2=0; c=0; for (i=0;i "/dev/stderr"; exit 1; } } flag="u" if (isnum(sum)&&isnum(sum2)) { flag="i" } print $1,sum/c,sqrt((sum2-sum*sum/c)/(c*(c-1))),flag; }' $t > $out || die "${0##*/}: averaging with awk failed" if [[ $clean = "yes" ]]; then rm -f "${tables[@]}" "$t" fi csg-1.6_rc1/share/scripts/inverse/table_change_flag.sh000077500000000000000000000016671357201131600231020ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat < $2 csg-1.6_rc1/share/scripts/inverse/table_combine.pl000077500000000000000000000125501357201131600222720ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; ( my $progname = $0 ) =~ s#^.*/##; my $usage="Usage: $progname [OPTIONS] "; my $epsilon=1e-5; my $op=undef; my $noflags=undef; my $dosum=undef; my $die=undef; my $scale=1.0; my $withflag=undef; while ((defined ($ARGV[0])) and ($ARGV[0] =~ /^-./)) { if (($ARGV[0] !~ /^--/) and (length($ARGV[0])>2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } elsif($ARGV[0] eq "--error") { shift(@ARGV); $epsilon = shift(@ARGV); } elsif($ARGV[0] eq "--no-flags") { shift(@ARGV); $noflags="yes"; } elsif($ARGV[0] eq "--op") { shift(@ARGV); $op = shift(@ARGV); } elsif($ARGV[0] eq "--scale") { shift(@ARGV); $scale = shift(@ARGV); } elsif($ARGV[0] eq "--die") { shift(@ARGV); $die = "yes"; } elsif($ARGV[0] eq "--sum") { shift(@ARGV); $dosum = "yes"; } elsif ($ARGV[0] eq "--withflag"){ shift(@ARGV); die "nothing given for --withflag" unless $#ARGV > -1; $withflag = shift(@ARGV); } elsif (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")) { print < abs($y)); return abs($x-$y)/abs($y); } sub operation($$$) { defined($_[2]) || die "operation: Missing argument\n"; my $x=$_[0]; my $op="$_[1]"; my $y=$_[2]; if ($op =~ /\+|-|\*|\/|x/) { $op="*" if ($op eq "x"); my $val = eval "$x $op $y"; die "operation: Could not calculate '$x $op $y'\n" if $@; return $val; } elsif ($op eq "=") { my $diff=&difference_relative($x,$y,$epsilon); return 1 if ($diff > $epsilon); return 0; } elsif ($op eq "d") { return abs($x-$y); } elsif ($op eq "d2") { return ($x-$y)*($x-$y); } else { die "operation: Unknown operation $op\n"; } } my $sum=0; my @table; for (my $i=0;$i<=$#r1; $i++) { # check for positions abs($r1[$i] - $r2[$i]) < $epsilon || die "$progname: first column different at position $i\n"; # check for flags unless ($noflags){ $flag1[$i] eq $flag2[$i] || die "$progname: flag different at position $i\n"; # skip if flag does not match if (($withflag) and ($flag1[$i] !~ m/[$withflag]/)) { next; } } # perform given operation my $value=&operation($pot1[$i],$op,$pot2[$i]); if (($die)&&($op eq "=")&&($value == 1)) { die "progname: second column different at position $i\n"; } $value*=$scale; $sum+=$value; $table[$i]=$value; } if ($die) { #notthing } elsif ($dosum) { print "$sum\n"; } else { my $comments="# $progname: combining $file1 $op $file2 into $ARGV[2]\n"; $comments.="#Comments from $file1\n$comments1" if (defined($comments1)); $comments.="#Comments from $file2\n$comments2" if (defined($comments2)); saveto_table($ARGV[2],@r1,@table,@flag1,$comments) || die "$progname: error at save table\n"; } csg-1.6_rc1/share/scripts/inverse/table_dummy.sh000077500000000000000000000042421357201131600220070ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2016 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # clean=no y1=0 y2=0 show_help () { cat < $tmpfile echo "$max ${y2}" >> $tmpfile comment="$(get_table_comment)" critical csg_resample --type linear --in ${tmpfile} --out "${2}" --grid "${1}" --comment "${comment}" if [[ $clean = "yes" ]]; then rm -f "${tmpfile}" fi csg-1.6_rc1/share/scripts/inverse/table_extrapolate.pl000077500000000000000000000144501357201131600232070ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # sub extrapolate_constant($$$$) { my $y0 = $_[1]; return $y0; } sub extrapolate_linear($$$$) { my $x0 = $_[0]; my $y0 = $_[1]; my $m = $_[2]; my $x = $_[3]; return $m*($x - $x0) + $y0; } sub sasha_shit($$$$) { my $x0 = $_[0]; my $y0 = $_[1]; my $m = $_[2]; my $x = $_[3]; my $a = ($m**2)/(4*$y0); my $b = $x0 - 2*$y0/$m; #my $b = $x0 + 2*$y0/$m; #my $a = $m/(2*($x0-$b)); return $a*($x-$b)**2; } sub extrapolate_quad($$$$) { my $x0 = $_[0]; my $y0 = $_[1]; my $m = $_[2]; my $x = $_[3]; # $curv is a global variable my $a = 0.5*$m/$curv - $x0; my $b = $y0 - 0.25*$m*$m/$curv; return $curv*($x + $a)**2 + $b } sub extrapolate_exp($$$$) { my $x0 = $_[0]; my $y0 = $_[1]; my $m = $_[2]; my $x = $_[3]; my $a = $y0*exp(-$m*$x0 / $y0); my $b = $m/$y0; return $a*exp($b*$x); } use strict; $_=$0; s#^.*/##; my $progname=$_; my $usage="Usage: $progname [OPTIONS] "; my $avgpoints = 3; my $function="quadratic"; my $region = "leftright"; my $flag_update ="yes"; our $curv = 10000.0; # curvature for quadratic extrapolation # read program arguments while ((defined ($ARGV[0])) and ($ARGV[0] =~ /^-./)) { if (($ARGV[0] !~ /^--/) and (length($ARGV[0])>2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if($ARGV[0] eq "--avgpoints") { $avgpoints = $ARGV[1]; shift(@ARGV); shift(@ARGV); } elsif($ARGV[0] eq "--function") { $function = $ARGV[1]; shift(@ARGV); shift(@ARGV); } elsif($ARGV[0] eq "--region") { $region = $ARGV[1]; shift(@ARGV); shift(@ARGV); } elsif($ARGV[0] eq "--curvature") { $curv = $ARGV[1]; shift(@ARGV); shift(@ARGV); } elsif($ARGV[0] eq "--no-flagupdate") { shift(@ARGV); $flag_update="no"; } elsif (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")) { print < 0; use CsgFunctions; my $infile="$ARGV[0]"; my @r; my @val; my @flag; my $comments; (readin_table($infile,@r,@val,@flag,$comments)) || die "$progname: error at readin_table\n"; my $outfile="$ARGV[1]"; #============== my ($do_left, $do_right); # parse $region: decide where to extrapolate if ($region eq "left") { $do_left = 1; $do_right = 0; } elsif ($region eq "right") { $do_left = 0; $do_right = 1; } elsif ($region eq "leftright") { $do_left = 1; $do_right = 1; } else { die "$progname: Unknown region: $region !\n"; } my $extrap_method; # parse $function: decide which method to use if ($function eq "constant") { $extrap_method = \&extrapolate_constant; } elsif ($function eq "linear") { $extrap_method = \&extrapolate_linear; } elsif ($function eq "quadratic") { $extrap_method = \&extrapolate_quad; } elsif ($function eq "exponential") { $extrap_method = \&extrapolate_exp; } elsif ($function eq "sasha") { $extrap_method = \&sasha_shit; } else { die "$progname: Unknown extrapolation function: $function !\n"; } # do extrapolation: left if ($do_left) { # find beginning my $first; for ($first=0;$first<=$#r;$first++) { last if($flag[$first] eq "i"); } # grad of beginning my $grad_beg; if ($function eq "constant") { $grad_beg = 0; } else { $grad_beg = ($val[$first + $avgpoints] - $val[$first])/($r[$first + $avgpoints] - $r[$first]); } print "$progname: extrapolating the left using $function with gradient $grad_beg\n"; # now extrapolate beginning for(my $i=$first-1; $i >= 0; $i--) { $val[$i] = &{$extrap_method}($r[$first], $val[$first], $grad_beg, $r[$i]); $flag[$i]="i" if ($flag_update eq "yes"); } } # do extrapolation: right if ($do_right) { # find end my $last; for ($last=$#r;$last>0;$last--) { last if($flag[$last] eq "i"); } # grad of end my $grad_end; if ($function eq "constant") { $grad_end = 0; } else { $grad_end = ($val[$last] - $val[$last - $avgpoints])/($r[$last] - $r[$last-$avgpoints]); } print "$progname: extrapolating the right using $function with gradient $grad_end\n"; # now extrapolate ends for(my $i=$last+1; $i <= $#r; $i++) { $val[$i] = &{$extrap_method}($r[$last], $val[$last], $grad_end, $r[$i]); $flag[$i]="i" if ($flag_update eq "yes"); } } #============== saveto_table($outfile,@r,@val,@flag,$comments) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/table_functional.sh000077500000000000000000000075421357201131600230240ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # show_help () { cat < "$tmpfile" echo -e "#\n#Plot script:" >> "$tmpfile" [[ -n $vars ]] && echo -e "$vars" >> "$tmpfile" for i in "${headers[@]}"; do echo "load '$i'" >> "$tmpfile" done echo "set samples $samples" >> "$tmpfile" echo "set table '$tmpfile2'" >> "$tmpfile" echo "plot [${grid[1]}:${grid[3]}] $fct" >> "$tmpfile" critical $gnuplot "$tmpfile" critical sed -e 's/^#*/#/' "$tmpfile" > "$output" echo -e "#\n# Gnuplot output:" >> "$output" critical sed -e '/^[[:space:]]*$/d' "$tmpfile2" >> "$output" if [[ $clean = "yes" ]]; then rm -f "$tmpfile" "$tmpfile2" fi csg-1.6_rc1/share/scripts/inverse/table_get_value.pl000077500000000000000000000036071357201131600226340ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; $_=$0; s#^.*/##; my $progname=$_; my $usage="Usage: $progname [OPTIONS] X infile"; # read program arguments while ((defined ($ARGV[0])) and ($ARGV[0] =~ /^-./)) { if (($ARGV[0] !~ /^--/) and (length($ARGV[0])>2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")) { print < 0; use CsgFunctions; my $X="$ARGV[0]"; my $infile="$ARGV[1]"; my @x; my @y; my @flag; (readin_table($infile,@x,@y,@flag)) || die "$progname: error at readin_table\n"; my $value=$y[0]; for(my $i=1; $i<=$#x; $i++) { if($x[$i]<$X) { $value=$y[$i]; } else { $value=$y[$i] unless (($x[$i]-$X)>($X-$x[$i-1])); print "$value\n"; exit 0; } } die "$progname: value $X not found\n"; csg-1.6_rc1/share/scripts/inverse/table_integrate.pl000077500000000000000000000120651357201131600226410ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; $_=$0; s#^.*/##; my $progname=$_; my $usage="Usage: $progname [OPTIONS] "; my $with_errors="no"; my $with_entropie="no"; my $kbT=undef; my $from="right"; my $spherical="no"; # read program arguments while ((defined ($ARGV[0])) and ($ARGV[0] =~ /^-./)) { if (($ARGV[0] !~ /^--/) and (length($ARGV[0])>2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")) { print <=0;$i--){ if ($r[$i]>0) { $force[$i] += 2*$kbT/$r[$i]; } } } if ("$spherical" eq "yes"){ for (my $i=0;$i<=$#r;$i++){ $force[$i] *= ($r[$i])**2; } } my $outfile="$ARGV[1]"; my @pot; my @pot_errors; my @ww; if ("$from" eq "right") { #calc pot with trapez rule #int_j= sum_i^j (r_i+1 - r_i)*(f_i+f_i+1)/2 #int_j+1= int_j + (r_i+1 - r_i)*(f_i+f_i+1)/2 #int_j= int_j+1 - (r_i+1 - r_i)*(f_i+f_i+1)/2 #begin from end to make pot(max)=0 $pot[$#r]=0; $ww[$#r]=0; for (my $i=$#r-1;$i>=0;$i--){ #hh = delta x /2 my $hh=0.5*($r[$i+1]-$r[$i]); $pot[$i]=$pot[$i+1] - $hh*($force[$i+1]+$force[$i]); $ww[$i]+= $hh; $ww[$i+1]+= $hh; } #ww contains w_i=(r_i+1-r_i-1)/2 if ("$with_errors" eq "yes") { #all error are independent(we assume that) #resort sum (only one force per summand) # U_j= sum_i ^j = sum_i^j f_i(r_i+1 - r_i-1)/2 + randterm # o^2(U_j)=sum_i o^2(f_i)*(r_i+1 - r_i-1)/2 + o^2(randterm) my $var_int = ($ww[$#r]*$force_errors[$#r])**2; $pot_errors[$#r]=sqrt($var_int); for(my $i=$#r-1; $i>=0;$i--) { my $hh = 0.5*($r[$i+1] - $r[$i]); $pot_errors[$i] = sqrt($var_int + ($hh*$force_errors[$i])**2); $var_int += ($ww[$i]*$force_errors[$i])**2; } } } else { $pot[0]=0; $ww[0]=0; for (my $i=1;$i<=$#r;$i++){ #hh = delta x /2 my $hh=0.5*($r[$i]-$r[$i-1]); $pot[$i]=$pot[$i-1] + $hh*($force[$i]+$force[$i-1]); $ww[$i]+= $hh; $ww[$i+1]+= $hh; } if ("$with_errors" eq "yes") { my $var_int = ($ww[0]*$force_errors[0])**2; $pot_errors[0]=sqrt($var_int); for(my $i=1; $i<=$#r;$i++) { my $hh = 0.5*($r[$i] - $r[$i-1]); $pot_errors[$i] = sqrt($var_int + ($hh*$force_errors[$i])**2); $var_int += ($ww[$i]*$force_errors[$i])**2; } } } if ("$with_errors" eq "yes") { (saveto_table_err($outfile,@r,@pot,@pot_errors,@flag)) || die "$progname: error at save table\n"; }else { (saveto_table($outfile,@r,@pot,@flag)) || die "$progname: error at save table\n"; } csg-1.6_rc1/share/scripts/inverse/table_linearop.pl000077500000000000000000000063071357201131600224720ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; $_=$0; s#^.*/##; my $progname=$_; my $usage="Usage: $progname [OPTIONS] "; #Defaults my $withflag=undef; my $with_errors="no"; my $col="y"; while ((defined ($ARGV[0])) and ($ARGV[0] =~ /^-./)) { if (($ARGV[0] !~ /^--/) and (length($ARGV[0])>2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")) { print < -1; $withflag = shift(@ARGV); } elsif ($ARGV[0] eq "--with-errors"){ shift(@ARGV); $with_errors="yes"; } elsif ($ARGV[0] eq "--on-x"){ shift(@ARGV); $col="x"; } else { die "Unknown option '".$ARGV[0]."' !\n"; } } #Print usage die "missing parameters\n$usage\n" unless $#ARGV >= 3; my $a = $ARGV[2]; my $b = $ARGV[3]; use CsgFunctions; my $file="$ARGV[0]"; my $outfile="$ARGV[1]"; print "$progname: $file to $outfile with $col' = $a*$col + $b \n"; my @r; my @val; my @flag; my @errors; my $comments=""; if ("$with_errors" eq "yes") { (readin_table_err($file,@r,@val,@errors,@flag,$comments)) || die "$progname: error at readin_table\n"; } else { (readin_table($file,@r,@val,@flag,$comments)) || die "$progname: error at readin_table\n"; } for(my $i=0; $i<=$#r; $i++) { # skip if flag does not match if(($withflag) and ($flag[$i] !~ m/[$withflag]/)) { next; } if ("$col" eq "x") { $r[$i]=$a*$r[$i]+$b; } else { $val[$i] = $a*$val[$i] + $b; if ("$with_errors" eq "yes") { $errors[$i] = $a*$errors[$i]; } } } $comments.="# $progname: $file -> $outfile $col' = $a*$col + $b\n"; if ("$with_errors" eq "yes") { saveto_table_err($outfile,@r,@val,@errors,@flag,$comments) || die "$progname: error at save table\n"; }else { saveto_table($outfile,@r,@val,@flag,$comments) || die "$progname: error at save table\n"; } csg-1.6_rc1/share/scripts/inverse/table_scale.pl000077500000000000000000000040671357201131600217510ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; $_=$0; s#^.*/##; my $progname=$_; my $usage="Usage: $progname [OPTIONS] infile outfile prefactor1 prefactor2"; # read program arguments while ((defined ($ARGV[0])) and ($ARGV[0] =~ /^-./)) { if (($ARGV[0] !~ /^--/) and (length($ARGV[0])>2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")) { print <=3 ; use CsgFunctions; my $infile="$ARGV[0]"; my @r; my @val; my @flag; my $comments; (readin_table($infile,@r,@val,@flag,$comments)) || die "$progname: error at readin_table\n"; my $outfile="$ARGV[1]"; my @out; my $prefactor="$ARGV[2]"; my $prefactor2 = "$ARGV[3]"; for (my $i=0;$i<=$#r;$i++){ # do a linear interpoltation between the prefactors $out[$i]=$i/$#r*$val[$i]*$prefactor2+(1-$i/$#r)*$val[$i]*$prefactor; } saveto_table($outfile,@r,@out,@flag,$comments) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/table_smooth.pl000077500000000000000000000033201357201131600221620ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; ( my $progname = $0 ) =~ s#^.*/##; if (defined($ARGV[0])&&("$ARGV[0]" eq "--help")){ print < EOF exit 0; } die "3 parameters are necessary\n" if ($#ARGV<2); use CsgFunctions; my $infile="$ARGV[0]"; my @r_cur; my @pot_cur; my @flag_cur; (readin_table($infile,@r_cur,@pot_cur,@flag_cur)) || die "$progname: error at readin_table\n"; my $outfile="$ARGV[1]"; my @pot; my $a = $ARGV[2]; # TODO: think about addition rules # now I did it like that to always maintain interval of interest in all potentials # find end my $last; for ($last=$#r_cur;$last>0;$last--) { last if($flag_cur[$last] eq "i"); } use constant { PI => 4 * atan2(1,1) }; for (my $i=0;$i<=$#r_cur;$i++){ $pot[$i]=$pot_cur[$i]; if($flag_cur[$i] eq "i") { if($r_cur[$i]>$a) { $pot[$i] = $pot_cur[$i] * cos(PI*($r_cur[$i]-$a)/(2.0*($r_cur[$last]-$a))) } } } saveto_table($outfile,@r_cur,@pot,@flag_cur) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/table_to_tab.pl000077500000000000000000000134551357201131600221330ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; ( my $progname = $0 ) =~ s#^.*/##; my $usage="Usage: $progname [OPTIONS] "; my $type="non-bonded"; my $sim_prog="none"; while ((defined ($ARGV[0])) and ($ARGV[0] =~ /^-./)) { if (($ARGV[0] !~ /^--/) and (length($ARGV[0])>2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")){ print < $outfile") or die "saveto_table: could not open $outfile\n"; if ($sim_prog eq "espresso") { # espresso specific header - no other starting comments printf(OUTFILE "#%d %f %f\n", $#r+1, $r[0],$r[$#r]); for(my $i=0;$i<=$#r;$i++){ printf(OUTFILE "%15.10e %15.10e %15.10e\n",$r[$i],-$pot_deriv[$i], $pot[$i]); } } elsif ($sim_prog eq "lammps") { if ($type eq "non-bonded"){ printf(OUTFILE "VOTCA\n"); printf(OUTFILE "N %i R %f %f\n\n",$#r+1,$r[0],$r[$#r]); for(my $i=0;$i<=$#r;$i++){ printf(OUTFILE "%i %15.10e %15.10e %15.10e\n",$i+1,$r[$i], $pot[$i], -$pot_deriv[$i]); } } elsif ( $type eq "bond" || $type eq "angle" ) { printf(OUTFILE "VOTCA\n"); printf(OUTFILE "N %i\n\n",$#r+1); for(my $i=0;$i<=$#r;$i++){ printf(OUTFILE "%i %12.5e %15.7e %15.7e\n",$i+1,$r[$i], $pot[$i], -$pot_deriv[$i]); } } elsif ( $type eq "dihedral" ) { printf(OUTFILE "VOTCA\n"); # see lammps manual, NOF causes LAMMPS to calculate forces from potential # see lammps manual RADIANS causes LAMMPS to assume units are in radians and not degrees printf(OUTFILE "N %i RADIANS NOF\n\n",$#r+1); for(my $i=0;$i<=$#r;$i++){ printf(OUTFILE "%i %12.5e %15.7e\n",$i+1,$r[$i], $pot[$i]); } } else { #should never happen die "$progname: tabulated potentials/forces for lammps $type not implemented\n"; } } elsif ($sim_prog eq "dlpoly") { if ($type eq "non-bonded"){ # see dlpoly manual ngrid = cut/delta + 4 = $#r + 4 as table starts with delta (not 0) # number of lines int((ngrid+3)/4) for(my $i=0;$i<4*int(($#r+7)/4);$i++){ printf(OUTFILE "%15.7e",($i>$#r)?0:$pot[$i]); printf(OUTFILE "%s",($i%4==3)?"\n":" "); } for(my $i=0;$i<4*int(($#r+7)/4);$i++){ # no scaling factor needed 1 kJ/nm *nm = 1 (kJ/Angs)*Angs printf(OUTFILE "%15.7e",($i>$#r)?0:-$pot_deriv[$i]*$r[$i]); printf(OUTFILE "%s",($i%4==3)?"\n":" "); } } elsif ( $type eq "bond" ) { for(my $i=0;$i<=$#r;$i++){ #nm -> Angs: $r[$i]*10.0 printf(OUTFILE "%12.5e %15.7e %15.7e\n",$r[$i]*10.0, $pot[$i], -$pot_deriv[$i]*$r[$i]); } } elsif ( $type eq "angle" || $type eq "dihedral" ) { my $RadToDegree=180.0/3.14159265359; for(my $i=0;$i<=$#r;$i++){ #rad -> degree: $r[$i]*$RadToDegree, and $pot_deriv[$i]/$RadToDegree printf(OUTFILE "%12.5e %15.7e %15.7e\n",$r[$i]*$RadToDegree, $pot[$i], -$pot_deriv[$i]/$RadToDegree); } } else { #should never happen die "$progname: tabulated potentials/forces for dlpoly $type not implemented\n"; } } elsif ($sim_prog eq "gromacs") { printf(OUTFILE "#This is just a failback, for using different columns use table_to_xvg.pl instead!\n"); for(my $i=0;$i<=$#r;$i++){ printf(OUTFILE "%15.10e %15.10e %15.10e %15.10e %15.10e %15.10e %15.10e\n",$r[$i], ,0,0,0,0,$pot[$i], -$pot_deriv[$i]); } } else { #generic for espressopp / hoomd-blue for(my $i=0;$i<=$#r;$i++){ printf(OUTFILE "%15.10e %15.10e %15.10e\n",$r[$i], $pot[$i], -$pot_deriv[$i]); } } close(OUTFILE) or die "Error at closing $outfile\n"; csg-1.6_rc1/share/scripts/inverse/table_to_xvg.pl000077500000000000000000000074771357201131600222000ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; ( my $progname = $0 ) =~ s#^.*/##; my $usage="Usage: $progname [OPTIONS] "; my $type="non-bonded"; my $gmx_max=undef; while ((defined ($ARGV[0])) and ($ARGV[0] =~ /^-./)) { if (($ARGV[0] !~ /^--/) and (length($ARGV[0])>2)){ $_=shift(@ARGV); #short opt having agruments examples fo if ( $_ =~ /^-[fo]/ ) { unshift(@ARGV,substr($_,0,2),substr($_,2)); } else{ unshift(@ARGV,substr($_,0,2),"-".substr($_,2)); } } if (($ARGV[0] eq "-h") or ($ARGV[0] eq "--help")){ print <$gmx_max; $pot[$i]=-$gmx_max if $pot[$i]<-$gmx_max; } } my @force; #calc force for (my $i=1;$i<$#r;$i++){ $force[$i]=-($pot[$i+1]-$pot[$i-1])/($r[$i+1]-$r[$i-1]); } if ( "$type" eq "dihedral" ) { $force[0]=-($pot[1]-$pot[$#r-1])/($r[1]-$r[0]+$r[$#r]-$r[$#r-1]); $force[$#r]=$force[0]; } else { $force[0]=0; $force[$#r]=0.0; } open(OUTFILE,"> $outfile") or die "saveto_table: could not open $outfile\n"; my $fmt=undef; my $begin=0; my $end=undef; if (( "$type" eq "non-bonded" ) or ("$type" eq "C12" )) { $fmt=sprintf("%%15.10e %15.10e %15.10e %15.10e %15.10e %%15.10e %%15.10e\n",0,0,0,0); } elsif ( "$type" eq "C6" ){ $fmt=sprintf("%%15.10e %15.10e %15.10e %%15.10e %%15.10e %15.10e %15.10e\n",0,0,0,0); } elsif ( "$type" eq "CB" ){ $fmt=sprintf("%%15.10e %%15.10e %%15.10e %15.10e %15.10e %15.10e %15.10e\n",0,0,0,0); } elsif ( "$type" eq "bond" ){ $fmt="%15.10e %15.10e %15.10e\n"; } elsif ( "$type" eq "angle" ){ $fmt="%15.10e %15.10e %15.10e\n"; $end=180; } elsif ( "$type" eq "dihedral" ){ $fmt="%15.10e %15.10e %15.10e\n"; $begin=-180; $end=180; } else{ die "$progname: Unsupported type of interatction: $type -> go and implement it\n"; } die "$progname: table for type $type should begin with $begin, but I found $r[0]\n" if(abs($begin-$r[0]) > 1e-3); die "$progname: table for type $type should end with $end, but I found $r[$#r]\n" if(($end) and (abs($end-$r[$#r]) > 1e-3)); print OUTFILE "$comments" if (defined($comments)); for(my $i=0;$i<=$#r;$i++){ printf(OUTFILE "$fmt",$r[$i],$pot[$i], $force[$i]); } close(OUTFILE) or die "Error at closing $outfile\n"; csg-1.6_rc1/share/scripts/inverse/tables_jackknife.pl000077500000000000000000000043041357201131600227640ustar00rootroot00000000000000#! /usr/bin/perl -w # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; ( my $progname = $0 ) =~ s#^.*/##; if (defined($ARGV[0])&&("$ARGV[0]" eq "--help")){ print < 0) { my $file_cur="$ARGV[0]"; my @r_cur; my @val_cur; my @flag_cur; (readin_table($file_cur,@r_cur,@val_cur,@flag_cur)) || die "$progname: error at readin_table\n"; #should never happen, but .... die "Different grids\n" if (($r_delta[1]-$r_delta[0]-$r_cur[1]+$r_cur[0])>0.0001); die "Different start potential point \n" if (($r_delta[0]-$r_cur[0]) > 0.0001); die "Different end potential point \n" if ( $#r_cur != $#r_delta ); for (my $i=0;$i<=$#r_cur;$i++) { $err[$i] += ($val_cur[$i] - $val_full[$i])**2; # is already nan or we don't change } shift @ARGV; $nblocks = $nblocks + 1; } for (my $i=0;$i<=$#r_full;$i++) { $err[$i]=sqrt(($nblocks-1)/$nblocks*$err[$i]); } saveto_table_err($outfile,@r_full,@val_full,@flag_full,@err) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/tag_file.sh000077500000000000000000000022601357201131600212550ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat < "$output" || die "${0##*/}: sed failed" cat "$input" >> "$output" || die "${0##*/}: sed failed" csg-1.6_rc1/share/scripts/inverse/update_ibi.sh000077500000000000000000000021351357201131600216110ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat <0.0001); die "Different start potential point \n" if (($r_aim[0]-$r_cur[0]) > 0.0001); die "Different end potential point \n" if ( $#r_aim != $#r_cur ); my $outfile="$ARGV[3]"; my @dpot; my @flag; my $value=0.0; #start from the end to make the begining have the last value for (my $i=$#r_aim;$i>=0;$i--){ if (($rdf_aim[$i] > 1e-10) && ($rdf_cur[$i] > 1e-10)) { $dpot[$i]=log($rdf_cur[$i]/$rdf_aim[$i])*$pref; $flag[$i]="i"; } else { $dpot[$i]=$value; $flag[$i]="o"; } if($pot_flags_cur[$i] =~ /[u]/) { $dpot[$i]=$value; $flag[$i]="o"; } else { $value=$dpot[$i]; } } my $comment="#progname: aim_rdf=$aim_rdf_file cur_rdf=$cur_rdf_file cur_pot=$cur_rdf_file\n"; saveto_table($outfile,@r_aim,@dpot,@flag,$comment) || die "$progname: error at save table\n"; csg-1.6_rc1/share/scripts/inverse/update_ibi_single.sh000077500000000000000000000034711357201131600231560ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat < "${otype}.state.try" do_external ${otype} precede_state "${otype}.state.try" "${otype}.state.done" state="$(critical sed -n 's/#State = \(.*\)$/\1/p' ${otype}.state.done)" [[ ${otype} = simplex ]] && msg "Simplex state changed to $state" else pending="$(echo "$pending" | critical sed -n '$=')" msg "There are still $pending simulations to be performed before the next ${otype} state change" critical sed "${active}s/0 active$/ $conv complete/" "${otype}.state.cur" > "${otype}.state.done" if [[ ${otype} = cma ]]; then critical cp "${otype}.internal_state.cur" "${otype}.internal_state.new" fi fi do_external optimizer state_to_potentials "${otype}.state.done" "${otype}.state.new" csg-1.6_rc1/share/scripts/inverse/update_optimizer_single.sh000077500000000000000000000034101357201131600244260ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat < "${name}.conv" tasklist=$(csg_get_interaction_property --allow-empty inverse.post_update) [[ -z $tasklist ]] || die "Postupd tasks for $name found, this is not allowed in optimizer" csg-1.6_rc1/share/scripts/inverse/update_re.sh000077500000000000000000000050271357201131600214570ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2017 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ "$1" = "--help" ]; then cat <" "0"; then msg --color blue --to-stderr "Automatically setting equi_time to 0, because CSG_RUNTEST was set" equi_time=0 fi first_frame="$(csg_get_property cg.inverse.$sim_prog.first_frame)" if [[ ${CSG_RUNTEST} ]] && csg_calc "$first_frame" ">" "0"; then msg --color blue --to-stderr "Automatically setting first_frame to 0, because CSG_RUNTEST was set" first_frame=0 fi csg_reupdate_opts="$(csg_get_property --allow-empty cg.inverse.re.csg_reupdate.opts)" if [[ ${CSG_RUNTEST} ]] ; then msg --color blue --to-stderr "Automatically adding '--hessian-check no', because CSG_RUNTEST was set" csg_reupdate_opts+=" --hessian-check no" fi tasks=$(get_number_tasks) if is_done "re_update"; then echo "RE update is already done" else #copy+resample all target dist in $this_dir for_all "non-bonded bonded" do_external resample target '$(csg_get_interaction_property inverse.target)' '$(csg_get_interaction_property name).dist.tgt' critical csg_reupdate --nt $tasks --top ${topol} --trj $traj --options $CSGXMLFILE --begin $equi_time --first-frame $first_frame ${csg_reupdate_opts} mark_done "re_update" fi csg-1.6_rc1/share/scripts/still_dirty/000077500000000000000000000000001357201131600200335ustar00rootroot00000000000000csg-1.6_rc1/share/scripts/still_dirty/calc_rdf_gromacs.sh000077500000000000000000000060201357201131600236400ustar00rootroot00000000000000#! /bin/bash # # Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicale law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [[ $1 = "--help" ]]; then cat < #include #include #include #include #include // using namespace votca::tools; using namespace std; using namespace votca::csg; class CsgTestApp : public CsgApplication { string ProgramName() override { return "template_nblist"; } void HelpText(ostream &out) override { out << "rough template for rdf calculations"; } void Initialize() override; bool DoTrajectory() override { return true; } void BeginEvaluate(Topology *top, Topology *top_ref) override; void EvalConfiguration(Topology *top, Topology *top_ref) override; void EndEvaluate() override; protected: votca::tools::HistogramNew _rdf; double _cut_off; }; int main(int argc, char **argv) { CsgTestApp app; return app.Exec(argc, argv); } void CsgTestApp::EvalConfiguration(Topology *top, Topology *) { BeadList b; b.Generate(*top, "*"); NBListGrid nb; nb.setCutoff(_cut_off); nb.Generate(b); for (auto &pair : nb) { _rdf.Process(pair->dist()); } } void CsgTestApp::Initialize() { CsgApplication::Initialize(); AddProgramOptions("RDF options")( "c", boost::program_options::value()->default_value(1.0), "the cutoff"); } void CsgTestApp::BeginEvaluate(Topology *, Topology *) { _cut_off = OptionsMap()["c"].as(); _rdf.Initialize(0, _cut_off, 50); } void CsgTestApp::EndEvaluate() { _rdf.data().Save("rdf.dat"); } csg-1.6_rc1/share/template/template_threaded.cc000066400000000000000000000141171357201131600216030ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include #include #include #include #include #include using namespace std; using namespace votca::csg; // comments were mainly added to explain the "overhead" needed for threaded // calculations/analyzations // to sum it up: instead of having one "thread" doing all your work (the whole // tracetory), you may split it into single frames and distribute it among many // "workers". a solid choice is: number of cores = number of workers. you, as // the user, are required to define how to initialize and merge your workers. // the main part of the program, EvalConfiguration, is shifted to the Worker // class but other than that stays untouched compared to a non-threaded version class CsgTestApp : public CsgApplication { string ProgramName() override { return "template_threaded_rdf"; } void HelpText(ostream &out) override { out << "template for threaded rdf calculations"; } void Initialize() override; bool DoTrajectory() override { return true; } // explicitly turn on threaded mode by overriding DoThreaded() and returning // true note that threads will be started and merged in an ordered way by // default this has the disadvantage of slowing everything down a bit (you // will likely not notice a decrease of performance), but the advantage of // processing frames in their original order in most cases, you want that in // some cases, where reading and writing/merging does not have to occur in // order, you may consider switching SynchronizeThreads() off in this example, // where an rdf-like value is calculated, ordered reading/writing is not // neccessary. however, leave it untouched to prevent future mistakes bool DoThreaded() override { return true; } // are you sure? really? // bool SynchronizeThreads() { // return false; // } void BeginEvaluate(Topology *top, Topology *top_ref) override; void EndEvaluate() override; // ForkWorker is the function you need to override and initialize your workers CsgApplication::Worker *ForkWorker(void) override; // MergeWorker needs you to define how to merge different workers and their // data void MergeWorker(Worker *worker) override; protected: // data belonging to the main class CsgTestApp votca::tools::HistogramNew _rdf; double _cut_off; }; // derive from CsgApplication::Worker and define your worker class RDFWorker : public CsgApplication::Worker { public: ~RDFWorker() override = default; // override EvalConfiguration with your analysis routine void EvalConfiguration(Topology *, Topology *) override; // data belonging to this particular worker votca::tools::HistogramNew _rdf; double _cut_off; }; int main(int argc, char **argv) { CsgTestApp app; return app.Exec(argc, argv); } void CsgTestApp::Initialize() { CsgApplication::Initialize(); AddProgramOptions("RDF options")( "c", boost::program_options::value()->default_value(1.0), "the cutoff"); } void CsgTestApp::BeginEvaluate(Topology *, Topology *) { _cut_off = OptionsMap()["c"].as(); _rdf.Initialize(0, _cut_off, 50); } // create and initialize single workers // ForkWorker() will be called as often as the parameter '--nt NTHREADS' // it creates a new worker and the user is required to initialize variables etc. // (if needed) CsgApplication::Worker *CsgTestApp::ForkWorker() { RDFWorker *worker; worker = new RDFWorker(); // initialize worker->_cut_off = OptionsMap()["c"].as(); worker->_rdf.Initialize(0, worker->_cut_off, 50); return worker; } // EvalConfiguration does the actual calculation // you won't see any explicit threaded stuff here void RDFWorker::EvalConfiguration(Topology *top, Topology *) { BeadList b; b.Generate(*top, "*"); NBListGrid nb; nb.setCutoff(_cut_off); nb.Generate(b); for (auto &pair : nb) { _rdf.Process(pair->dist()); } } // the user is required to define how to merge the single data // belonging to each thread into the main data belonging to CsgTestApp void CsgTestApp::MergeWorker(Worker *worker) { RDFWorker *myRDFWorker; // cast generel Worker into your derived worker class(here RDFWorker) myRDFWorker = dynamic_cast(worker); // the next comment block explains how mutexes are used internally for this // function: mutexes are used to exclusively work on data e.g., if you read or // write global data, make sure that nobody else (i.e. no other worker) works // on that very same piece of data at the same time; otherwise, you will end // up with wrong results that you struggle to understand the parent class // handles a "merging mutex" for you internally; this is what happens: first, // a mutex is created, e.g. // Mutex rdfMutex; // then, for each worker, the mutex is first locked // rdfMutex.Lock()) // and MergeWorker(worker) is called (i.e. the code you define here is // executed) after MergeWorker exits, the mutex is unlocked // rdfMutex.Unlock(); // and allows other threads to get a lock and start merging // now follows your code // merging of data in this simple example is easy and does not have to follow // the original order of frames (since plain summing is commutative) _rdf.data().y() = _rdf.data().y() + myRDFWorker->_rdf.data().y(); } void CsgTestApp::EndEvaluate() { _rdf.data().y() = _rdf.data().y().cwiseQuotient(_rdf.data().x().cwiseAbs2()); _rdf.data().Save("rdf.dat"); } csg-1.6_rc1/share/xml/000077500000000000000000000000001357201131600146025ustar00rootroot00000000000000csg-1.6_rc1/share/xml/CMakeLists.txt000066400000000000000000000016561357201131600173520ustar00rootroot00000000000000set(CSG_DEFAULTS csg_defaults.xml) file(GLOB_RECURSE VOTCA_XML *.xml) file(GLOB_RECURSE NOT_VOTCA_XML ${CSG_DEFAULTS}) if(NOT_VOTCA_XML) list(REMOVE_ITEM VOTCA_XML ${NOT_VOTCA_XML}) endif() install(FILES ${VOTCA_XML} DESTINATION ${CMAKE_INSTALL_DATADIR}/votca/xml) find_program(GMX_EXECUTABLE gmx_d gmx) find_package_handle_standard_args(GMX REQUIRED_VARS GMX_EXECUTABLE) if(NOT GMX_FOUND) set(GMX_EXECUTABLE "gmx") endif() find_program(LMP_EXECUTABLE lmp lammps) find_package_handle_standard_args(LMP REQUIRED_VARS LMP_EXECUTABLE) if(NOT LMP_FOUND) set(LMP_EXECUTABLE "lmp") endif() set(MDRUN "${GMX_EXECUTABLE} mdrun") set(G_ENERGY "${GMX_EXECUTABLE} energy") set(GROMPP "${GMX_EXECUTABLE} grompp") set(G_TRJCAT "${GMX_EXECUTABLE} trjcat") configure_file(${CSG_DEFAULTS}.in ${CMAKE_CURRENT_BINARY_DIR}/${CSG_DEFAULTS} @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CSG_DEFAULTS} DESTINATION ${CMAKE_INSTALL_DATADIR}/votca/xml) csg-1.6_rc1/share/xml/csg_defaults.xml.in000066400000000000000000001025771357201131600204100ustar00rootroot00000000000000 Section containing the all coarse-graining options Force matching options boolean variable: false - simple least squares, true - constrained least squares. For details see the VOTCA paper. Practically, both algorithms give the same results, but simple least squares is faster. If you are a mathematician and you think that a spline can only then be called a spline if it has continuous first and second derivatives, use constrained least squares. 1e-5 Accuracy for evaluating the difference in bead positions. Default is 1e-5 number of frames, being used for block averaging. Atomistic trajectory, specified with --trj option, is divided into blocks and the force matching equations are solved separately for each block. Coarse-grained force-field, which one gets on the output is averaged over those blocks. general options for inverse script these files are removed after each iteration 0 lower convergency limit to stop none type of convergence check to do general dlpoly specific options DLPOLY.Z command to run dlpoly (name or absolute path or 'mpirun dlpoly' or such) .dlpf Name of dlpoly topology file .dlph Name of the output dlpoly trajectory file REVIVE REVCON Names of the dlpoly checkpoint files dlpoly internal grid end point for tabulated non-bonded potentials (applied to all non-bonded) dlpoly internal grid number for tabulated non-bonded potentials (applied to all non-bonded) dlpoly specs for tabulated bonded potentials (applied to all bonds) dlpoly internal grid end point for tabulated potentials dlpoly internal grid number for tabulated potentials dlpoly specs for tabulated bonded potentials (applied to all angles) dlpoly internal grid number for tabulated potentials dlpoly specs for tabulated bonded potentials (applied to all dihedrals) dlpoly internal grid number for tabulated potentials python3 Command to run espresso (name or absolute path or mpirun espresso..) ${script} option to be given to espresso program, use ${script} in there 0 trash the given number of frames at the beginning of trajectory espresso internal grid for tabulated potentials Name of the output Espresso trajectory file python2 Command to run espresso (name or absolute path or mpirun espresso..) ${script} option to be given to espresso program, use ${script} in there 0 trash the given number of frames at the beginning of trajectory these files are copied to each iteration step gnuplot gnuplot binary to use gromacs specific options conf.gro Name of the coordinate file read by grompp confout.gro Name of the original outcome coordinate written by mdrun Length of the block for the error analysis no calculate error on the density: yes/no 0 begin analysis after this time when using gromacs (max of this and first_frame is used) 0 trash the given number of frames at the beginning of trajectory (max of this and first_frame is used) @G_ENERGY@ Name (or absolute path) of the g_energy binary Additional options to Gromacs g_energy (e.g. -P 1) options for pressure calculation using g_energy no is nan an allowed result: yes/no Gromacs binary topol (tpr) file to use by g_energy GMXRC to source at the startup @GROMPP@ Name (or absolute path) of the grompp binary Additional options to Gromacs grompp (e.g. -maxwarn 1) index.ndx Gromacs grompp index file to used by grompp Separate log file for gromacs programs (useful with mdrun -v) grompp.mdp Gromacs mdp file to be used by grompp state.cpt Name of the checkpint to use in case of restarted simulation @MDRUN@ Command to run mdrun (name or absolute path or mpirun mdrun..) List of directories for multidir simulations Additional options to Gromacs mdrun (e.g. -nosum) 1000000 cut the potential at this value (gromacs bug) no A pre simulation (e.g. minimization / equilibration ) is a simulation with a different mdp/topol/index Gromacs grompp index file to used by grompp in the pre simulation Gromacs mdp file to be used by grompp in the pre simulation Gromacs text topol (top) file to use by grompp in the pre simulation Options for the case that calculation of reference system is needed 0 begin analysis after this time when using gromacs (max of this and first_frame is used) 0 trash the given number of frames at the beginning of trajectory (max of this and first_frame is used) Mapping to apply on the coarse-grained topology, use autogenerated ones (cg.inverse.optimizer.mapping.output) and given ones (map other components) Contains options for Reference rdf calculation Extra options to give to csg_stat (e.g. --nframes 100) Reference binary topology(global or local path) Reference trajectory(global or local path) Length of the block for the error analysis Space separated list of special mapping file(s) for rdf calculations needed for bonded interactions no calculate error on the rdf: yes/no 0.002 grid for gromacs xvg table extend the gromacs xvg tables to this value yes check kBT against t_ref in mdp file: yes/no topol.top Gromacs text topology (top) file read by grompp topol.tpr Gromacs binary topology (tpr) file to be written by grompp and used for the simlation traj.xtc Gromacs trajectory file to use @G_TRJCAT@ Name (or absolute path) of the trjcat binary hoomd Command to run hoomd-blue (name or absolute path or mpirun ..) ${script} option to be given to hoomd-blue program, use ${script} in there general imc specific options 0 default magnitude for regularization parameter if not given for the group explicitly, default =0 general lammps specific options @LMP_EXECUTABLE@ command to run lammps (name or absolute path or mpirun lammps..) -in ${script} option to be given to lammps program, use ${script} in there trajectory file to be created by lammps, use a format like xyz, which can be read by csg_stat pressure file generated by lammps, use "fix print" in lammps input (e.g., "fix pressure all print 50 "${mypress}" file lammps.pressure screen no title "LAMMPS_PRESSURE" " ; pressure_file would be lammps.pressure in this example). The title can be anything as VOTCA skips over this line as a header when parsing options, which apply to all simulation programs Command to run for the simulation (name or absolute path or mpirun XXX ..) Name of the coordinate file read by the simulation program (if needed) Name of the original outcome coordinate written by simulation program (if any) 0 begin analysis after this time (max of this and first_frame is used) Length of the block for the error analysis no calculate error on the density: yes/no 0 trash the given number of frames at the beginning of trajectory (max of this and first_frame is used) Special topology file to be used for csg_stat used in imc Special trajectory file to be used for csg_stat used in imc Special topology file to be used for csg_reupdate Special trajectory file to be used for csg_reupdate Length of the block for the error analysis Space separated list of special mapping file(s) for rdf calculations needed for bonded interactions Special topology file to be used for csg_stat Special trajectory file to be used for csg_stat n calculate error on the rdf: yes/no General topology file to be use if no special one is specified trajectory file to be created by the simulation program option to be given to simulation program, use ${script} in there general options for realtive entropy method options for the csg_reupdate command 1 number of steps to be used for average computation. For relative entropy method, these many last iteration steps are used to compute average CG potentials or parameters or both. maindir what initial configuration to use in every step: maindir/laststep/nowhere. do the given number of iterations (0=inf) kBT in KJ/mol (i.e. XXX K *0.00831451) inverse.log name of the log file Special mapping file(s) for rdf calculations needed for bonded interactions method to be performed: ibi/imc/ft/optimizer general options for the cma optimizer standard epsilon, in which the best solution is searched Type of optimizer to be used gromacs simulation package to be used (gromacs/espresso/lammps) restart_points.log Name of the restart file in case a step has to be resumed 1e-10 minimal value for the rdf to consider for initial guess of the potential) list of directories for user scripts (e.g. $PWD) separated by a colon (like PATH) simulation options no tells csg_inverse that simulation was send to the backgroud auto number of threads to use for csg_stat grid Grid search algorithm, simple (N square search) or grid Interaction specific option for bonded interactions, see the cg.non-bonded section for all options
Header of the interaction in dlpoly TABBND or TABANG file. The header should be a unique set of the interaction-site names, and these should match the corresponding names specified in the mapping file.
Name of the bonded interaction. The name can be arbitrary but should be unique. For bonded interactions, this should match the name specified in the mapping file. 0 set to 1 when calculating bond dihedral potentials with csg_fmatch -> enforces periodicity of potential. (default is 0)
Interaction specific option for non-bonded interactions
Header of the interaction in dlpoly TABLE file. The header should be a unique pair of the interaction-site names, and these should match the corresponding names specified in the mapping file.
Name of the interaction. The name can be arbitrary but should be unique. For bonded interactions, this should match the name specified in the mapping file. **Bead** type 1 of non-bonded interaction. **Bead** type 2 of non-bonded interaction. Internal alias for "non-bonded" or "bonded", set automatically Lower bound of interval for potential table in which calculations are performed. Should be set based on reference distributions. Upper bound of interval for potential table in which calculations are performed. Should be set based on reference distributions. Step size of interval for potential table in which calculations are performed. If step site is too small, lots of statistics is needed ( long runs ). If it's too big, features in the distribtuion/potentials might get lost. Force matching options Minimum value of interval for distribution sampled in atomistic MD simulation. One can get this number by looking at the distribution function for this interaction. For non-bonded interactions it's the distance to the rdf start. For CG bonds and angles the variable has the similar meaning ( note, that for angles it is specified in radians ). Maximum value of interval for distribution sampled in atomistic MD simulation. One can get this number by looking at the distribution function for this interaction. For non-bonded interactions it's the cut-off of the interaction. grid spacing for the spline, which represents the interaction. This parameter should not be too big, otherwise you might lose some features of the interaction potential, and not too small either, otherwise you will have unsampled bins which result in an ill-defined equation system and NaNs in the output. Grid spacing for the output grid. Normally, one wants to have this parameter smaller than fmatch.step, to have a smooth curve, without additional spline interpolation. As a rule of thumb we normally use fmatch.out_step which is approximately 5 times smaller than fmatch.step. Relative entropy options Functional form for the potential. Available functional forms: lj126 (Lennard-Jones 12-6), ljg (Lennard-Jones 12-6 plus Gaussian), and cbspl (uniform cubic B-splines). options specific to cbspl function form Number of knot values to be used for the cbspl functional form. Uniform grid size of the CBSPL depends on this parameter; for fixed potential range more the nknots smaller the grid spacing. Make sure grid spacing is sufficiently large and enough CG simulation steps are performed such that the bins at distance greater than the minimum distance are sampled sufficiently otherwise ill-defined system of equation would give NaNs in the output. Contains all information relevant to iterative process target distribution (e.g. rdf) which is tried to match during iterations to match pressure contribution of this interaction particle density of this species (for wjk pressure correction) 1 Update cycle for the potential update. 1 means update, 0 don't update. 1 1 0 means update 2 iterations, then don't one iteration update, then repeat. Espresso specific options for this interations Name of file for tabulated potential of this interaction. This fill will be created from the internal tabulated potential format in every step. Note, though, that the original espresso script needs to contain the name of that table as the tabulated interaction (see tutorial methanol ibi_espresso for details).
Gromacs specific options for this interations Name of file for tabulated potential of this interaction. This fill will be created from the internal tabulated potential format in every step.
interaction specific options, which apply to all simulation programs Name of file for tabulated potential of this interaction. This fill will be created from the internal tabulated potential format in every step. Note, though, that the original simulation script needs to contain the name of that table as the tabulated interaction (see tutorial methanol ibi_espresso for details).
Start of the tabulated potential of this interaction. (Automatic for gromacs) End of the tabulated potential of this interaction. (Automatic for gromacs) Extrapolation function to use on the left. Default: exponential(non-bonded), linear (bonded), Options: constant linear quadratic exponential sasha Extrapolation function to use on the right. Default: constant(non-bonded), linear (bonded), Options: constant linear quadratic exponential sasha Binszie of the tabulated potential of this interaction. (gromacs uses a non interaction specific option)
ection containing inverse monte carlo specific options. Group of interaction. Cross-correlations of all members of a group are taken into account for calculating the update. If no cross correlations should be calculated, interactions have to be put into different groups. lammps specific options for this interations 1 x-axis scaling factor for the potential output, can be used to convert VOTCA units, nm, to other units, e.g. angstroms Name of file for tabulated potential of this interaction. This fill will be created from the internal tabulated potential format in every step. Note, though, that the lammps script needs to contain the name of that table as the tabulated interaction and the interaction is stored in the VOTCA section of the file..
1 y-axis scaling factor for the potential output, can be used to convert VOTCA units, kJ/mol, to other units, e.g. kcal/mol
Additional post processing of U after dU added to potential. This is a list of scripts separated by spaces which are called. See section on iterative framework for details. Contains all options of post add scripts Contains all options of the postadd compress sripts Files to be compressed -9 Option to give to the compression command gzip Compression command to run 1 weight factors for the convergence of this interaction, should be a list of same length as inverse.post_add_options.convergence.what dist list from what to calc the convergence: dist pot, .. tgt what base values to be used to compute convergene error: tgt, cur, .. 1 which norm to use to compute error: 1 first norm, 2 second norm Contains all options of the postadd copyback sripts File to be copied to back to maindir Contains all options of the overwrite postadd scripts 1 Cycle for overwrite postadd script (1 do, 0 do not) like do_potential. Contains all options of the plot postadd scripts 8 file descriptor to use, make it unique if you want to plot multiple things extra options to give to gnuplot_bin like -persist or -geometry kill all processes with that name before ploting (e.g. gnuplot_x11), this is more reliable than using named pipes list for which averages of last few steps are to computed: param, pot, ... For relative entropy method, specify param before pot. Additional post-processing of dU before added to potential. This is a list of scripts separated by spaces which are called. See section on iterative framework for details. Contains all options of post update scripts Contains all options of the Kirkwood-Buff integral corrections scripts 1 Update cycle for the Kirkwood-Buff integral correction (1 do, 0 do not). To do the correction every third step specify "0 0 1", similar to do_potential no calculate errors on the Kirkwood-Buff integral: yes/no no 5 Number of point to calculate the average from for the extrapolation Contains all options of the Kirkwood-Buff ramp corrections scripts 1 Update cycle for the Kirkwood-Buff ramp correction (1 do, 0 do not). To do the correction every third step specify "0 0 1", similar to do_potential scaling factor for the ramp correction no calculate errors on the Kirkwood-Buff integral: yes/no no cutoff of the ramp Where to start averaging the Kirkwood-Buff integral for the ramp Where to stop averaging the Kirkwood-Buff integral for the ramp Contains all options of the Lennard-Jones potential update The c6 value for the extra LJ potential The c12 value for the extra LJ potential Contains all options of the pressure correction scripts 1 Update cycle for the pressure correction (1 do, 0 do not). To do pressure correction every third step specify "0 0 1", similar to do_potential Contains all options of the simple pressure correction slope of the simple pressure correction Generic Pressure correction options slope of the pressure correction simple Pressure correction type, can be simple or wjk Contains all options of the wjk pressure correction 1.0 extra scaling factor of pressure wjk correction 1.0 scale factor for the update Contains all options of the post_update smooth script 1 number of triangular smooth to be performed Contains all options of the post_update spline smooth script grid spacing for spline fit when doing spline smoothing Contains all options for the density calculation of the optimizer x Axis along which the density is calculated Lower bound of interval in which density calculation is performed. Upper bound of interval in which density calculation is performed. Step size of interval in which density calculation is performed. 1.0 Scaling factor for density * The molname of this interaction Filename of the target denstiy distribution in the maindir Functional form of the interaction, using parameters in here If the function is very complicated it can be defined in this files, which is used as an header option related to mapping changes no Does the mapping change in optimization: yes/no no Output file name for mapping Parameters to be fitted by the optimizer for this interaction. Note that the parameter names are global Contains all options for the pressure calculation of the optimizer Pressure to use if pressure from the simulation was nan (use a big number) Contains all options for the rdf calculation of the optimizer Filename of the target rdf in the maindir Weighting function for calculating the convergency of the rdf File with the weighting function definition calculating the rdf rdf Targets to be fitted by the optimizer 1 Weight of the targets, amount has to be the same as of targets
csg-1.6_rc1/share/xml/mapping.xml000066400000000000000000000053241357201131600167630ustar00rootroot00000000000000 Name of molecule in coarse-grained representation. Molecule name in reference topology. Section defining coarse grained beads of molecule. Section defining coarse grained beads of molecule. Definition of a coarse grained bead. Name of coarse grained bead. Type of coarse grained bead. Mapping scheme to be used for this bead (specified in section mapping) to map from reference system. The beads section lists all atoms of the reference system that are mapped to this particular coarse grained bead. The syntax is RESID:RESNAME:ATOMNAME, the beads are separated by spaces. The cg_bonded section contains all bonded interaction of the molecule. Those can be bond, angle or dihedral. An entry for each group of bonded interaction can be specified, e.g. several groups (types) of bonds can be specified. A specific bonded interaction can be later on addressed by MOLECULE:NAME:NUMBER, where MOLECULE is the molecule ID in the whole topology, NAME the name of the interaction group and NUMBER addresses the interaction in the group. Definition of a group of bonds. Name of the bond. List of pair of beads that define a bond. Names specified in cg_beads Definition of a group of angles. Name of the angle List of triples of beads that define a bond. Names specified in cg_beads Definition of a group of dihedrals. Since the exact functional form does not matter, this combines proper as well as improper dihedrals. Name of the dihedral List of quadruples of beads that define a bond. Names specified in cg_beads Section containing definitions of mapping schemes. Section for a mapping for 1 bead. Name of the mapping Weights of the mapping matrix. Entries are normalized to 1, number of entries must match the number of reference beads in a coarse-grained bead. csg-1.6_rc1/share/xml/topol.xml000066400000000000000000000062361357201131600164700ustar00rootroot00000000000000 The XML topology root element, the base for the topology can be defined by the "name" attribute Attribute name holds the name of particles group in H5MD file The the molecules in the trajectory or other operation on the molecules. Definition of the molecule, with attributes: name, nmols and nbeads. The name defines residue name, nmols tells how many times this molecule has to be replicated to match with trajectory file and nbeads defines number of beads in every molecule. Define the bead in the molecule. Attributes are: name - the name of bead, type - the type of bead, mass - the mass of bead, q - the value of charge and resid - the id of the residue the bead belongs to (>=1). Clear the information about the molecules Rename the molecules; attributes: "name" - the new name, "range" - the range where the new name will be set in the format start_range:end_range Define the molecules; attributes: "name" - the name of molecule, "first" - the id of first molecule, "nbeads" - the number of beads in the molecule, "nmols" - the number of molecules This section defines the topology of the molecules, it is used to generate proper exclusions for calculating rdfs Describes the bond The name of the bond The pair of the beads in the format MOLECULE_NAME:BEAD_NAME Describes the angle The name of the angle The triplet of the beads in the format MOLECULE_NAME:BEAD_NAME Describes the dihedrals The name of the dihedral The quadruplet of the beads in the format MOLECULE_NAME:BEAD_NAME Allows defining bead types Rename the bead type; attributes: "name" - the old name, "newname" - the new name Define the mass of the bead type; attributes: "name" - the bead type name, "value" - the new mass csg-1.6_rc1/src/000077500000000000000000000000001357201131600134675ustar00rootroot00000000000000csg-1.6_rc1/src/CMakeLists.txt000066400000000000000000000002061357201131600162250ustar00rootroot00000000000000add_subdirectory(libcsg) add_subdirectory(tools) add_subdirectory(csg_boltzmann) if(ENABLE_TESTING) add_subdirectory(tests) endif() csg-1.6_rc1/src/csg_boltzmann/000077500000000000000000000000001357201131600163275ustar00rootroot00000000000000csg-1.6_rc1/src/csg_boltzmann/CMakeLists.txt000066400000000000000000000026521357201131600210740ustar00rootroot00000000000000file(GLOB CSG_BO_LIB_SOURCES *.cc) file(GLOB CSG_BO_MAIN_SOURCES main.cc) list(REMOVE_ITEM CSG_BO_LIB_SOURCES ${CSG_BO_MAIN_SOURCES}) # for >=cmake-3.12: replace STATIC by OBJECT add_library(votca_csg_boltzmann STATIC ${CSG_BO_LIB_SOURCES}) target_link_libraries(votca_csg_boltzmann votca_csg) add_executable(csg_boltzmann ${CSG_BO_MAIN_SOURCES}) target_link_libraries(csg_boltzmann votca_csg_boltzmann votca_csg) install(TARGETS csg_boltzmann EXPORT VOTCA_CSG_Targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) set_property(TARGET votca_csg APPEND PROPERTY BINARIES "csg_boltzmann") add_executable(VOTCA::csg_boltzmann ALIAS csg_boltzmann) if (TXT2TAGS_FOUND AND BASH) add_custom_command(OUTPUT csg_boltzmann.man COMMAND ${CMAKE_CURRENT_BINARY_DIR}/csg_boltzmann --help > csg_boltzmann.help DEPENDS csg_boltzmann COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/../../scripts/help2t2t csg_boltzmann.help > csg_boltzmann.t2t COMMAND ${TXT2TAGS_EXECUTABLE} -q -t man -i csg_boltzmann.t2t -o csg_boltzmann.man DEPENDS help2t2t_build csg_boltzmann) add_custom_target(csg_boltzmann_manpage DEPENDS csg_boltzmann.man) add_dependencies(manpages csg_boltzmann_manpage) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/csg_boltzmann.man DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 RENAME csg_boltzmann.1) set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES csg_boltzmann.help csg_boltzmann.t2t) endif(TXT2TAGS_FOUND AND BASH) csg-1.6_rc1/src/csg_boltzmann/Makefile_nb000066400000000000000000000043351357201131600204530ustar00rootroot00000000000000# # There exist several targets which are by default empty and which can be # used for execution of your targets. These targets are usually executed # before and after some main targets. They are: # # .build-pre: called before 'build' target # .build-post: called after 'build' target # .clean-pre: called before 'clean' target # .clean-post: called after 'clean' target # .clobber-pre: called before 'clobber' target # .clobber-post: called after 'clobber' target # .all-pre: called before 'all' target # .all-post: called after 'all' target # .help-pre: called before 'help' target # .help-post: called after 'help' target # # Targets beginning with '.' are not intended to be called on their own. # # Main targets can be executed directly, and they are: # # build build a specific configuration # clean remove built files from a configuration # clobber remove all built files # all build all configurations # help print help mesage # # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and # .help-impl are implemented in nbproject/makefile-impl.mk. # # NOCDDL # Environment MKDIR=mkdir CP=cp CCADMIN=CCadmin RANLIB=ranlib # build build: .build-pre .build-impl .build-post .build-pre: # Add your pre 'build' code here... .build-post: # Add your post 'build' code here... # clean clean: .clean-pre .clean-impl .clean-post .clean-pre: # Add your pre 'clean' code here... .clean-post: # Add your post 'clean' code here... # clobber clobber: .clobber-pre .clobber-impl .clobber-post .clobber-pre: # Add your pre 'clobber' code here... .clobber-post: # Add your post 'clobber' code here... # all all: .all-pre .all-impl .all-post .all-pre: # Add your pre 'all' code here... .all-post: # Add your post 'all' code here... # help help: .help-pre .help-impl .help-post .help-pre: # Add your pre 'help' code here... .help-post: # Add your post 'help' code here... # include project implementation makefile include nbproject/Makefile-impl.mk csg-1.6_rc1/src/csg_boltzmann/analysistool.h000066400000000000000000000026351357201131600212270ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef VOTCA_CSG_ANALYSISTOOL_H #define VOTCA_CSG_ANALYSISTOOL_H #include "bondedstatistics.h" #include #include #include /** \brief base class for all analysis tools This is the base class for all analysis tool. \todo do option functions!!! */ namespace votca { namespace csg { class AnalysisTool { public: AnalysisTool() = default; virtual ~AnalysisTool() = default; virtual void Register(std::map &lib) = 0; virtual void Command(BondedStatistics &bs, const std::string &cmd, std::vector &args) = 0; virtual void Help(const std::string &cmd, std::vector &args) = 0; }; } // namespace csg } // namespace votca #endif // VOTCA_CSG_ANALYSISTOOL_H csg-1.6_rc1/src/csg_boltzmann/bondedstatistics.cc000066400000000000000000000025341357201131600222100ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include "bondedstatistics.h" using namespace votca::tools; namespace votca { namespace csg { void BondedStatistics::BeginCG(Topology *top, Topology *) { _bonded_values.clear(); for (auto &interaction : top->BondedInteractions()) { _bonded_values.CreateArray(interaction->getName()); } } void BondedStatistics::EndCG() {} void BondedStatistics::EvalConfiguration(Topology *conf, Topology *) { InteractionContainer &ic = conf->BondedInteractions(); InteractionContainer::iterator ia; DataCollection::iterator is; for (ia = ic.begin(), is = _bonded_values.begin(); ia != ic.end(); ++ia, ++is) { (*is)->push_back((*ia)->EvaluateVar(*conf)); } } } // namespace csg } // namespace votca csg-1.6_rc1/src/csg_boltzmann/bondedstatistics.h000066400000000000000000000033451357201131600220530ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef VOTCA_CSG_BONDEDSTATISTICS_H #define VOTCA_CSG_BONDEDSTATISTICS_H #include #include namespace votca { namespace csg { /** * \brief Class calculates data associated with bond interactions * * This class will essentially calculate and store information related to each * type of interaction. For instance for the IBond which is the interaction * between two beads it will calculate and store the distance between the two * beads involved in the interaction. It will calculate a similar metric for all * other interactions such as IAngle, IDihedral etc... **/ class BondedStatistics : public votca::csg::CGObserver { public: void BeginCG(Topology *top, Topology *top_atom = nullptr) override; void EndCG() override; void EvalConfiguration(Topology *conf, Topology *conf_atom = nullptr) override; tools::DataCollection &BondedValues() { return _bonded_values; } protected: tools::DataCollection _bonded_values; }; } // namespace csg } // namespace votca #endif // VOTCA_CSG_BOLZMANNINVERSION_H csg-1.6_rc1/src/csg_boltzmann/main.cc000066400000000000000000000151731357201131600175710ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ // TODO: This code need lots of cleaning up! please do not look at anything in // here! // #include "analysistool.h" #include "bondedstatistics.h" #include "stdanalysis.h" #include "tabulatedpotential.h" #include #include #include #include #include #include #include #include using namespace std; using namespace votca::csg; class CsgBoltzmann : public CsgApplication { public: string ProgramName() override { return "csg_boltzmann"; } void HelpText(ostream &out) override { out << "Performs tasks that are needed for simple boltzmann\n" "inversion in an interactive environment."; } bool DoTrajectory() override { return true; } bool DoMapping() override { return true; } void Initialize() override; bool EvaluateOptions() override; void Run() override; void InteractiveMode(); bool EvaluateTopology(Topology *top, Topology *top_ref) override; protected: ExclusionList *CreateExclusionList(Molecule &atomistic, Molecule &cg); BondedStatistics _bs; }; void CsgBoltzmann::Initialize() { CsgApplication::Initialize(); AddProgramOptions("Special options")( "excl", boost::program_options::value(), "write atomistic exclusion list to file"); AddObserver(&_bs); } bool CsgBoltzmann::EvaluateOptions() { CsgApplication::EvaluateOptions(); if (OptionsMap().count("excl")) { CheckRequired("cg", "excl options needs a mapping file"); } return true; } bool CsgBoltzmann::EvaluateTopology(Topology *top, Topology *top_ref) { if (OptionsMap().count("excl")) { ExclusionList *ex; if (top_ref->MoleculeCount() > 1) { cout << "WARNING: cannot create exclusion list for topology with" "multiple molecules, using only first molecule\n"; } cout << "Writing exclusion list for atomistic molecule " << top_ref->MoleculeByIndex(0)->getName() << " in coarse grained representation " << top_ref->MoleculeByIndex(0)->getName() << endl; ex = CreateExclusionList(*top_ref->MoleculeByIndex(0), *top->MoleculeByIndex(0)); std::ofstream fl; fl.open(OptionsMap()["excl"].as()); fl << "# atomistic: " << top_ref->MoleculeByIndex(0)->getName() << " cg: " << top_ref->MoleculeByIndex(0)->getName() << " cgmap: " << OptionsMap()["cg"].as() << endl; fl << *ex; fl.close(); delete ex; return false; } return true; } ExclusionList *CsgBoltzmann::CreateExclusionList(Molecule &atomistic, Molecule &cg) { ExclusionList *ex = new ExclusionList(); // exclude all with all { list excl_list; for (votca::Index i = 0; i < atomistic.BeadCount(); ++i) { excl_list.push_back(atomistic.getBead(i)); } ex->ExcludeList(excl_list); } // remove exclusions from inside a mapped bead Topology *at_top = atomistic.getParent(); for (votca::Index i = 0; i < cg.BeadCount(); ++i) { const vector &parent_beads = cg.getBead(i)->ParentBeads(); list excl_list; for (const votca::Index &parent_bead_id : parent_beads) { excl_list.push_back(at_top->getBead(parent_bead_id)); } ex->Remove(excl_list); } // remove exclusion which come from atomistic topology and hence bonds and // angles Topology *cg_top = cg.getParent(); for (votca::Index i = 0; i < cg.BeadCount() - 1; ++i) { for (votca::Index j = i + 1; j < cg.BeadCount(); ++j) { if (cg_top->getExclusions().IsExcluded(cg.getBead(i), cg.getBead(j))) { const vector &parent_beads_w = cg.getBead(i)->ParentBeads(); const vector &parent_beads_v = cg.getBead(j)->ParentBeads(); for (const votca::Index parent_bead_id_w : parent_beads_w) { for (const votca::Index parent_bead_id_v : parent_beads_v) { ex->RemoveExclusion(at_top->getBead(parent_bead_id_w), at_top->getBead(parent_bead_id_v)); } } } } } return ex; } void CsgBoltzmann::Run() { CsgApplication::Run(); if (OptionsMap().count("excl")) { return; } InteractiveMode(); } void CsgBoltzmann::InteractiveMode() { std::map cmds; TabulatedPotential tab; StdAnalysis std; tab.Register(cmds); std.Register(cmds); string help_text = "Interactive mode, expecting commands:\n" "help: show this help\n" "q: quit\n" "list: list all available bonds\n" "vals : write values to file\n" "hist : create histogram\n" "tab : create tabulated potential\n" "autocor : calculate autocorrelation, only one row " "allowed in selection!\n" "cor : calculate correlations, first row is correlated " "with all other rows"; cout << help_text << endl; while (1) { string line; cout << "> "; getline(cin, line); boost::trim(line); votca::tools::Tokenizer tok(line, " \t"); vector args = tok.ToVector(); if (args.size() == 0) { continue; } string cmd = args.front(); args.erase(args.begin()); if (cmd == "q") { break; } std::map::iterator tool; if (cmd == "help") { if (args.size() == 0) { cout << help_text << endl; continue; } cmd = args.front(); args.erase(args.begin()); tool = cmds.find(cmd); if (tool == cmds.end()) { cout << "error, no help item found" << endl; continue; } tool->second->Help(cmd, args); cout << endl; continue; } tool = cmds.find(cmd); if (tool == cmds.end()) { cout << "error, command not found" << endl; continue; } tool->second->Command(_bs, cmd, args); } } int main(int argc, char **argv) { CsgBoltzmann app; app.Exec(argc, argv); } csg-1.6_rc1/src/csg_boltzmann/stdanalysis.cc000066400000000000000000000107531357201131600212020ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include "stdanalysis.h" #include "analysistool.h" #include "bondedstatistics.h" #include #include #include #include #include namespace votca { namespace csg { void StdAnalysis::Register(std::map &lib) { lib["list"] = this; lib["vals"] = this; lib["cor"] = this; lib["autocor"] = this; } void StdAnalysis::Command(BondedStatistics &bs, const std::string &cmd, std::vector &args) { if (cmd == "vals") { WriteValues(bs, args); } if (cmd == "cor") { WriteCorrelations(bs, args); } if (cmd == "autocor") { WriteAutocorrelation(bs, args); } if (cmd == "list") { votca::tools::DataCollection::selection *sel = bs.BondedValues().select("*"); std::cout << "Available bonded interactions:" << std::endl; for (auto &array : *sel) { std::cout << array->getName() << " " << std::endl; } delete sel; } } void StdAnalysis::Help(const std::string &cmd, std::vector &) { if (cmd == "vals") { std::cout << "vals \n" << "write values to file. The first row is the frame number, then one " << "row for each interaction specified. The output can be used to " "generate " << "2D correlation plots.\n\n" << "example: vals angle *angle*\n"; } if (cmd == "cor") { std::cout << "cor \n" << "Calculate linear correlation coefficient of the first item in " "selection with all the other items\n" << "WARNING: for evaluating correlations in the system, it is not " "sufficient to calculate the " << "linear correlation coefficient, 2D histograms with data from the " "vals command should be used instead!\n"; } if (cmd == "autocor") { std::cout << "autocor \n" << "calculate autocorrelation function of first item in selection. " "The output is periodic since FFTW3 is used to " "calcualte correlations.\n"; } if (cmd == "list") { std::cout << "list\nlists all available interactions\n"; } } void StdAnalysis::WriteValues(BondedStatistics &bs, std::vector &args) { std::ofstream out; votca::tools::DataCollection::selection *sel = nullptr; for (size_t i = 1; i < args.size(); i++) { sel = bs.BondedValues().select(args[i], sel); } out.open(args[0]); out << *sel << std::endl; out.close(); std::cout << "written " << sel->size() << " data rows to " << args[0] << std::endl; delete sel; } void StdAnalysis::WriteAutocorrelation(BondedStatistics &bs, std::vector &args) { std::ofstream out; votca::tools::DataCollection::selection *sel = nullptr; for (size_t i = 1; i < args.size(); i++) { sel = bs.BondedValues().select(args[i], sel); } votca::tools::CrossCorrelate c; c.AutoCorrelate(*sel); out.open(args[0]); out << c << std::endl; out.close(); std::cout << "calculated autocorrelation for " << sel->size() << " data rows, written to " << args[0] << std::endl; delete sel; } void StdAnalysis::WriteCorrelations(BondedStatistics &bs, std::vector &args) { std::ofstream out; votca::tools::DataCollection::selection *sel = nullptr; for (size_t i = 1; i < args.size(); i++) { sel = bs.BondedValues().select(args[i], sel); } votca::tools::Correlate c; c.CalcCorrelations(*sel); out.open(args[0]); out << c << std::endl; out.close(); std::cout << "calculated correlations for " << sel->size() << " rows, written to " << args[0] << std::endl; delete sel; } } // namespace csg } // namespace votca csg-1.6_rc1/src/csg_boltzmann/stdanalysis.h000066400000000000000000000030101357201131600210300ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef VOTCA_CSG_STDANALYSIS_H #define VOTCA_CSG_STDANALYSIS_H #include "analysistool.h" #include "bondedstatistics.h" #include namespace votca { namespace csg { class StdAnalysis : public AnalysisTool { public: StdAnalysis() = default; ~StdAnalysis() override = default; void Register(std::map &lib) override; void Command(BondedStatistics &bs, const std::string &cmd, std::vector &args) override; void Help(const std::string &cmd, std::vector &args) override; void WriteValues(BondedStatistics &bs, std::vector &args); void WriteCorrelations(BondedStatistics &bs, std::vector &args); void WriteAutocorrelation(BondedStatistics &bs, std::vector &args); }; } // namespace csg } // namespace votca #endif // VOTCA_CSG_STDANALYSIS_H csg-1.6_rc1/src/csg_boltzmann/tabulatedpotential.cc000066400000000000000000000267711357201131600225400ustar00rootroot00000000000000/* * Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include "tabulatedpotential.h" #include "analysistool.h" #include "bondedstatistics.h" #include #include #include #include #include #include #include #include #include using namespace std; using namespace votca::tools; namespace votca { namespace csg { /****************************************************************************** * Public Facing Methods ******************************************************************************/ TabulatedPotential::TabulatedPotential() { _tab_smooth1 = _tab_smooth2 = 0; _Temperature = 300; } void TabulatedPotential::Register(map &lib) { lib["tab"] = this; lib["hist"] = this; } void TabulatedPotential::Command(BondedStatistics &bs, const string &cmd, vector &args) { if (args[0] == "set") { if (cmd == "hist") { SetOption_(_hist_options, args); } else if (cmd == "tab") { if (!SetOption_(_tab_options, args)) { if (args.size() > 2) { if (args[1] == "smooth_pdf") { _tab_smooth1 = boost::lexical_cast(args[2]); } else if (args[1] == "smooth_pot") { _tab_smooth2 = boost::lexical_cast(args[2]); } else if (args[1] == "T") { _Temperature = boost::lexical_cast(args[2]); } else { cout << "unknown option " << args[2] << endl; return; } } } if (args.size() <= 2) { cout << "smooth_pdf: " << _tab_smooth1 << endl; cout << "smooth_pot: " << _tab_smooth2 << endl; cout << "T: " << _Temperature << endl; } } } else if (args.size() >= 2) { if (cmd == "hist") { WriteHistogram(bs, args); } else if (cmd == "tab") { WritePotential(bs, args); } } else { cout << "wrong number of arguments" << endl; } } void TabulatedPotential::Help(const string &cmd, vector &args) { if (args.size() == 0) { if (cmd == "tab") { cout << "tab \n" << "Calculate tabulated potential by inverting the distribution " "function. Statistics is calculated using all interactions in " "selection.\nsee also: help tab set\n\nexample:\ntab set scale " "bond\ntab U_bond.txt *:bond:*\n"; } if (cmd == "hist") { cout << "hist \n" << "Calculate distribution function for selection. Statistics is " "calculated using all interactions in selection.\n see also: help" " hist set\n\nexample:hist U_bond.txt *:bond:*\n"; } return; } if (args[0] == "set") { if (args.size() == 1) { cout << cmd << " set