from xmlrpclib import ServerProxy
from IPython.display import Image
import os, sys
import scipy as sp
from scipy import constants
from scipy.constants import codata
import numpy as np
import __main__
__main__.pymol_argv = [ 'pymol', '-cp' ]
import pymol
pymol.finish_launching()
from pymol import cmd
from IPython.display import Image
os.environ['PATH']=os.environ['PATH']+'/home/preps/golovin/progs/bin'
os.environ['MOPAC_LICENSE'] ='/home/preps/golovin/progs/bin'
os.environ['LD_LIBRARY_PATH']='/home/preps/golovin/progs/bin'
%%bash
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/preps/golovin/progs/lib
%%bash
echo 'C1=CC=C2C=CC=C2C=C1' > azulene.smi
%%bash
obgen azulene.smi -ff UFF > azulene.mol
cmd.delete('all')
cmd.load('azulene.mol')
cmd.refresh()
cmd.do('''
bg_color white
as sticks, all
orient, all
show sticks
set valence, on
set stick_ball, on
set stick_ball_ratio, 3
set stick_radius, 0.12
set valence_mode, 2
set ray_trace_mode, 3
ray
png pic1.png
''')
Image(filename='pic1.png')
Азулен получился плоский в поле UFF. Оптимизируем его с помощью MOPAC
cmd.save('azulene.pdb')
Запускаю MOPAC и babel через консоль
%%bash
babel -ipdb azulene.pdb -omop azulene.mop -xk "PM6"
/home/preps/golovin/progs/bin/MOPAC2009.exe azulene.mop
%%bash
babel -imopout azulene.out -omol azulene_new.mol
%%bash
echo 'c1ccc2ccccc2c1' > naphthalene.smi
%%bash
obgen naphthalene.smi > naphthalene.mol
cmd.delete('all')
cmd.load('naphthalene.mol')
cmd.refresh()
cmd.do('''
bg_color white
as sticks, all
orient, all
show sticks
set valence, on
set stick_ball, on
set stick_ball_ratio, 3
set stick_radius, 0.12
set valence_mode, 2
ray
png pic2.png
''')
Image(filename='pic2.png')
Нафтален получился плоский. И его оптимизируем.
cmd.save('naphthalene.pdb')
%%bash
babel -ipdb naphthalene.pdb -omop naphthalene.mop -xk "PM6"
/home/preps/golovin/progs/bin/MOPAC2009.exe naphthalene.mop
%%bash
babel -imopout naphthalene.out -omol naphthalene_new.mol
%%bash
babel -imol azulene_new.mol -ogamin azulene_opt.inp
babel -imol naphthalene_new.mol -ogamin naphthalene_opt.inp
with open("azulene_opt.inp") as f,open("azulene_opt_head.inp",'w') as o:
data=f.read()
data=data.replace("$CONTRL COORD=CART UNITS=ANGS $END","$CONTRL COORD=CART UNITS=ANGS SCFTYP=RHF RUNTYP=OPTIMIZE $END\n $BASIS GBASIS=N31 NGAUSS=6 $end\n $system mwords=2 $end")
o.write(data)
with open("naphthalene_opt.inp") as f,open("naphthalene_opt_head.inp",'w') as o:
data=f.read()
data=data.replace("$CONTRL COORD=CART UNITS=ANGS $END","$CONTRL COORD=CART UNITS=ANGS SCFTYP=RHF RUNTYP=OPTIMIZE $END\n $BASIS GBASIS=N31 NGAUSS=6 $end\n $system mwords=2 $end")
o.write(data)
%%bash
gms azulene_opt_head.inp 1 >& azulene_opt_head.log
gms naphthalene_opt_head.inp 1 >& naphthalene_opt_head.log
%%bash
babel -igamout azulene_opt_head.log -ogamin azulene_opt_head1.inp
babel -igamout naphthalene_opt_head.log -ogamin naphthalene_opt_head1.inp
with open("naphthalene_opt_head1.inp") as f,open("naphthalene_opt_head_hf.inp",'w') as o:
data=f.read()
data=data.replace("$CONTRL COORD=CART UNITS=ANGS $END","$CONTRL COORD=CART UNITS=ANGS SCFTYP=RHF RUNTYP=ENERGY $END\n $BASIS GBASIS=N31 NGAUSS=6\n POLAR=POPN31 NDFUNC=1 $END\n $GUESS GUESS=HUCKEL $END\n $system mwords=2 $end")
o.write(data)
with open("naphthalene_opt_head1.inp") as f,open("naphthalene_opt_head_tfp.inp",'w') as o:
data=f.read()
data=data.replace("$CONTRL COORD=CART UNITS=ANGS $END","$CONTRL COORD=CART UNITS=ANGS dfttyp=b3lyp RUNTYP=ENERGY $END\n $BASIS GBASIS=N31 NGAUSS=6\n POLAR=POPN31 NDFUNC=1 $END\n $GUESS GUESS=HUCKEL $END\n $system mwords=2 $end")
o.write(data)
with open("azulene_opt_head1.inp") as f,open("azulene_opt_head_hf.inp",'w') as o:
data=f.read()
data=data.replace("$CONTRL COORD=CART UNITS=ANGS $END","$CONTRL COORD=CART UNITS=ANGS SCFTYP=RHF RUNTYP=ENERGY $END\n $BASIS GBASIS=N31 NGAUSS=6\n POLAR=POPN31 NDFUNC=1 $END\n $GUESS GUESS=HUCKEL $END\n $system mwords=2 $end")
o.write(data)
with open("azulene_opt_head1.inp") as f,open("azulene_opt_head_tfp.inp",'w') as o:
data=f.read()
data=data.replace("$CONTRL COORD=CART UNITS=ANGS $END","$CONTRL COORD=CART UNITS=ANGS dfttyp=b3lyp RUNTYP=ENERGY $END\n $BASIS GBASIS=N31 NGAUSS=6\n POLAR=POPN31 NDFUNC=1 $END\n $GUESS GUESS=HUCKEL $END\n $system mwords=2 $end")
o.write(data)
%%bash
gms azulene_opt_head_hf.inp 1 >& azulene_opt_head_hf.log
gms naphthalene_opt_head_hf.inp 1 >& naphthalene_opt_head_hf.log
%%bash
gms azulene_opt_head_tfp.inp 1 >& azulene_opt_head_tfp.log
gms naphthalene_opt_head_tfp.inp 1 >& naphthalene_opt_head_tfp.log
Вещество | E Naphthalene | E Azulene | ΔE , Hartree | ΔE, kCal/mol |
---|---|---|---|---|
Хартри-Фок | -383.3549266833 | -383.2824728439 | 0.0724538394 | 45.4654702889 |
DFT | -385.6401507233 | -385.5856859589 | 0.0544647644 | 34.1771553879 |