Commit f862ce43 authored by Christoph Junghans's avatar Christoph Junghans

imc_purify.sh: major clean up

parent 1d55470a
#!/bin/bash
#
# Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org)
# 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.
......@@ -18,36 +18,32 @@
if [ "$1" = "--help" ]; then
cat <<EOF
${0##*/}, version %version%
This scripts cleans up the dpot tables for each interaction when using IMC
This scripts multiplies the dpot tables for each interaction when using IMC by kBT
and handles potential update schemes
Usage: ${0##*/}
EOF
exit 0
fi
name=$(csg_get_interaction_property name)
min=$(csg_get_interaction_property min)
max=$(csg_get_interaction_property max)
step=$(csg_get_interaction_property step)
kBT=$(csg_get_property cg.inverse.kBT)
bondtype="$(csg_get_interaction_property bondtype)"
echo "purifying dpot for $name"
comment="$(get_table_comment)"
critical csg_resample --in ${name}.dpot.imc --out ${name}.dpot.impure --grid ${min}:${step}:${max} --comment "$comment"
step_nr=$(get_current_step_nr)
scheme=( $(csg_get_interaction_property inverse.do_potential) )
scheme_nr=$(( ( $step_nr - 1 ) % ${#scheme[@]} ))
name=$(csg_get_interaction_property name)
if [ "${scheme[$scheme_nr]}" = 1 ]; then
echo "Update potential ${name} : yes"
do_external table linearop --withflag o ${name}.dpot.impure ${name}.dpot.impure 0 0
do_external table linearop --withflag i ${name}.dpot.impure ${name}.dpot.impure $kBT 0
kBT=$(csg_get_property cg.inverse.kBT)
is_num "${kBT}" || die "${0##*/}: cg.inverse.kBT should be a number, but found '$kBT'"
do_external table linearop ${name}.dpot.imc ${name}.dpot.imc.kBT $kBT 0
do_external potential shift --type "${bondtype}" ${name}.dpot.impure ${name}.dpot.new
bondtype="$(csg_get_interaction_property bondtype)"
do_external potential shift --type "${bondtype}" ${name}.dpot.kBT ${name}.dpot.new
else
echo "Update potential ${name} : no"
do_external table linearop ${name}.dpot.impure ${name}.dpot.new 0 0
min=$(csg_get_interaction_property min)
max=$(csg_get_interaction_property max)
step=$(csg_get_interaction_property step)
do_external table dummy ${min}:${step}:${max} ${name}.dpot.new
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment