3.5.1.1.2.1. crysolの対話モードの自動応答での実行¶
できるだけわかりやすいように、無駄な部分は省いている。
出力の文字列が乱れているが、気になるのならprint
がある文をコメントアウトすればよい。
[1]:
def auto_crysol(pdb_base,dat_base):
import pexpect
p = pexpect.spawn("crysol")
#2-1. Enter your option ...................... < 0 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
#2-2. Brookhaven file name ................... < .pdb >:
p.expect(r">:")
print (p.before+p.after)
p.sendline(pdb_base)
#2-3. Maximum order of harmonics ........... < 15 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
#2-4. Order of Fibonacci grid ............... < 17 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
#2-5. Maximum s value ........................ < .5000 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
#2-6. Number of points ....................... < 51 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("201")
#2-7. Account for explicit hydrogens? [ Y / N ] < No >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
#4-1. Fit the experimental curve [ Y / N ] .. < Yes >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
#4-2. Enter data file ........................ < .dat >:
p.expect(r">:")
print (p.before+p.after)
p.sendline(dat_base)
#5-1. Subtract constant ...................... < no >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("N")
#5-2. 2 * sin(theta)/lambda [1/nm] (4) ..... < 1 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
#6. Electron density of the solvent, e/A**3 < .3340 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
#7. Plot the fit [ Y / N ] ................. < Yes >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("N")
#8-1. Another set of parameters [ Y / N ] .... < No >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("Y")
#8-2. Minimize again with new limits [ Y / N ] < No >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("Y")
p.expect(r"Minimum")
ret=str(p.before)
# print ('ret',ret)
#Average atomic radius is ............................... :
m=ret.split(':')
# print('m',m[-1].split("\\")[0])
Ra=float(m[-1].split("\\")[0])
# 9-1. Minimum radius of atomic group ......... < 1.400 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline(str(Ra))
# 9-2. Maximum radius of atomic group ......... < 1.800 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline(str(Ra))
# 9-3. Smax in the fitting range .............. < 0.4984 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
# 9-4. Minimum contrast in the shell .......... < 0.000 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
# 9-5. Maximum contrast in the shell .......... < 7.5000E-002 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
p.expect(r"Minimum")
ret=str(p.before)
# print ('ret',ret)
#Van der Waals volume is ................................ :
m=ret.split(':')
# print('m',m[-1].split("\\")[0])
ExVol=float(m[-1].split("\\")[0])
# 9-6 Minimum excluded volume ................ < 1.6108E+004 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline(str(ExVol))
# 9-7. Maximum excluded volume ................ < 1.8720E+004 >:
p.expect(r">:")
print (p.before+p.after)
p.sendline(str(ExVol))
# 9-7. Subtract constant ...................... < no >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
# 10-1. Plot the fit [ Y / N ] ................. < Yes >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("N")
# 10-2. Another set of parameters [ Y / N ] .... < No >:
p.expect(r">:")
print (p.before+p.after)
p.sendline("")
#p.terminate()
p.expect(pexpect.EOF)
return
6lyz.pdb
: 結晶構造lyzexp.dat
: 実験データ
を入力して上の関数auto_crysol
を実行する。
[ ]:
auto_crysol('6lyz.pdb','lyzexp.dat')