#!/bin/env python # calculate new replica exchange temperature according to the old temperature and exchange rate import sys, re from lnx_util import parseInput, print_help import subprocess inputP= parseInput(sys.argv[1:]) paraOpt = '-flog -h'.split() helpdoc=\ ''' Usage! ./prog.py -flog run1_0.log ; log file from any replica -h ; print help information ''' print_help(inputP, paraOpt, helpdoc) finm = inputP['-flog'] rate = 0.25 exe = 'grep \'Repl fake T\' run1_0.log ' p= subprocess.Popen( exe, shell=True, stdout=subprocess.PIPE) temperature = [ float(i) for i in re.findall('\d*\.*\d*', p.stdout.readline() ) if len(i) >0 ] exe = 'grep -A 2 \'Repl average probabilities:\' run1_0.log | tail -n 1 ' p= subprocess.Popen( exe, shell=True, stdout=subprocess.PIPE)
# main file to modify topology for rest import sys import rest_lipid_top, rest_force_field_top import lnx_util inputP = lnx_util.parseInput(sys.argv[1:]) paraOpt = "-top -bondedTop -nonbondedTop -otop -obonded -ononbonded -T1 -T2 -sep -h".split() helpdoc = ( "Usage! ./prog.py \n" " -top top1 ; topology file for solutes that need rescale\n" " -bondedTop top2 ; force field file that contains bonded and non_boned interactions\n" " -nonbondedTop top3 ;\n" " -otop outTop1 ; topology modified from top1\n" " -obonded outTopbonded ; topology modified for bonded\n" " -ononbonded outTopnonbonded ; topology modified for nonbonded\n" " -T1 323 k ; \n" " -T2 600 k ; gamma = beta_2 / beta_1 \n" " ; charge: q_i = sqrt(gamma) *q_i ;\n" " ; vdw : epsilon_i = epsilon_i * gamma ; i belongs to solute ;\n" " -sep ; when sep flag is set, we print the topology as an individual top rather than free energy format \n" " -h ; print help doc \n" ) lnx_util.print_help(inputP, paraOpt, helpdoc) t1 = float(inputP["-T1"]) t2 = float(inputP["-T2"]) gamma = t1 / t2 print "gamma: %5.3f" % gamma