/usr/share/votca/scripts/inverse/pressure_cor_simple.pl is in votca-csg-scripts 1.3.0-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #! /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;
$progname, version %version%
This script calls the pressure corrections ''\$dU=A*(1-r/r_c)\$'', where
''\$A=-0.1k_B T * \\\\max(1,|p_cur-p_target|*scale) * \\\\sign(p_cur-p_target)\$''
Usage: $progname p_cur outfile
EOF
exit 0;
}
die "2 parameters are necessary\n" if ($#ARGV<1);
use CsgFunctions;
my $kBT=csg_get_property("cg.inverse.kBT");
my $max=csg_get_interaction_property("max");
my $min=csg_get_interaction_property("min");
my $delta_r=csg_get_interaction_property("step");
my $scale_factor=csg_get_interaction_property("inverse.post_update_options.pressure.simple.scale");
my $p_target=csg_get_interaction_property("inverse.p_target");
my $p_now=$ARGV[0];
#Determine the sign
my $pref;
if ($p_now>$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";
|