import sys from helper import * from PDB import * from geom import * from out_put import * import top_db import random #==Main== arg=sys.argv system = PDBdata(arg[1]) reslist=system.reslist xp=system.xp rtf_file='' for i in range(1,len(arg)): if arg[i][-3:] in ['rtf','str','inp']: rtf_file+=arg[i]+' ' nname = arg_w_opt(arg,'nname','CL-') pname = arg_w_opt(arg,'pname','NA+') conc= float(arg_w_opt(arg,'conc','0.1')) resrep = arg_w_opt(arg, 'replace', 'SOL') #===ionize tc = system.tcharge() print 'Total charge is ',tc print 'To neutralize the system and make ',conc,'M salt solution' vol = system.volume()/1000. st_M_nm3 = 0.602 n_ion_h = int(conc * st_M_nm3 * vol)/2 nn = n_ion_h np = n_ion_h atc =int(abs(tc)/2) htc =abs(tc)-atc if tc>0: si=1 elif tc<0: si=-1 else: si=0 nn+=si*atc np-=si*htc print nn,nname,'and',np,pname,'are added' print 'Residue',resrep,'will be replcaed by ions' #==== r_list=[] for i in reslist: if i[2]==resrep: r_list.append(i[0]) if len(r_list)