In [5]:
import os
os.environ['PATH']=os.environ['PATH']+'/home/preps/golovin/progs/bin'
os.environ['MOPAC_LICENSE']='/home/preps/golovin/progs/bin'
In [7]:
%%bash
obgen 1.smi > 1.mol
##Рассмотрим порфирин

A T O M   T Y P E S

IDX	TYPE
1	2
2	2
3	2
4	2
5	63
6	64
7	64
8	63
9	2
10	2
11	2
12	2
13	2
14	2
15	63
16	64
17	64
18	63
19	2
20	2
21	40
22	39
23	23
24	40
25	39
26	23
27	5
28	5
29	5
30	5
31	5
32	5
33	5
34	5
35	5
36	5
37	5
38	5
39	28
40	28

F O R M A L   C H A R G E S

IDX	CHARGE
1	0.000000
2	0.000000
3	0.000000
4	0.000000
5	0.000000
6	0.000000
7	0.000000
8	0.000000
9	0.000000
10	0.000000
11	0.000000
12	0.000000
13	0.000000
14	0.000000
15	0.000000
16	0.000000
17	0.000000
18	0.000000
19	0.000000
20	0.000000
21	0.000000
22	0.000000
23	0.000000
24	0.000000
25	0.000000
26	0.000000
27	0.000000
28	0.000000
29	0.000000
30	0.000000
31	0.000000
32	0.000000
33	0.000000
34	0.000000
35	0.000000
36	0.000000
37	0.000000
38	0.000000
39	0.000000
40	0.000000

P A R T I A L   C H A R G E S

IDX	CHARGE
1	-0.150000
2	-0.150000
3	0.100000
4	-0.105000
5	-0.196600
6	-0.150000
7	-0.150000
8	-0.196600
9	-0.105000
10	0.100000
11	-0.150000
12	-0.150000
13	0.100000
14	-0.105000
15	-0.196600
16	-0.150000
17	-0.150000
18	-0.196600
19	-0.105000
20	0.100000
21	-0.600000
22	0.033200
23	0.270000
24	-0.600000
25	0.033200
26	0.270000
27	0.150000
28	0.150000
29	0.150000
30	0.150000
31	0.150000
32	0.150000
33	0.150000
34	0.150000
35	0.150000
36	0.150000
37	0.150000
38	0.150000
39	0.400000
40	0.400000

S E T T I N G   U P   C A L C U L A T I O N S

SETTING UP BOND CALCULATIONS...
SETTING UP ANGLE & STRETCH-BEND CALCULATIONS...
SETTING UP TORSION CALCULATIONS...
SETTING UP OOP CALCULATIONS...
SETTING UP VAN DER WAALS CALCULATIONS...
SETTING UP ELECTROSTATIC CALCULATIONS...

S T E E P E S T   D E S C E N T

STEPS = 500

STEP n       E(n)         E(n-1)    
------------------------------------
    0    264078.579      ----
   10    387.25365    432.58667
   20    209.70161    217.70339
   30    154.22377    158.01412
   40    106.86242    119.63142
   50    84.10609    84.87622
   60    67.57597    69.40770
   70    61.27328    61.78441
   80    56.97943    57.36729
   90    53.61588    53.91493
  100    50.05210    50.69985
  110    47.19119    47.56112
  120    45.33161    45.56281
  130    44.09883    44.24992
  140    43.26196    43.36716
  150    42.70525    42.77019
  160    42.36422    42.38588
  170    42.09851    42.13219
  180    41.90225    41.91312
  190    41.73948    41.74118
  200    41.59001    41.60226
  210    41.41251    41.41886
  220    41.24580    41.25065
  230    41.16337    41.16363
  240    41.08282    41.08723
  250    41.01011    41.01397
  260    40.94642    40.94914
    STEEPEST DESCENT HAS CONVERGED

W E I G H T E D   R O T O R   S E A R C H

  NUMBER OF ROTATABLE BONDS: 0
  NUMBER OF POSSIBLE ROTAMERS: 1
  GENERATED ONLY ONE CONFORMER


S T E E P E S T   D E S C E N T

STEPS = 500

STEP n       E(n)         E(n-1)    
------------------------------------
    0      40.687      ----
   10    40.65904    40.66171
   20    40.62001    40.62742
   30    40.58169    40.58075
   40    40.55182    40.55683
   50    40.51349    40.51425
   60    40.48979    40.48937
   70    40.46681    40.46892
   80    40.43500    40.43461
   90    40.41479    40.41619
  100    40.39602    40.39666
  110    40.37464    40.38024
  120    40.35652    40.36082
  130    40.32946    40.33215
  140    40.29588    40.29930
  150    40.28237    40.28354
  160    40.26648    40.26765
  170    40.25543    40.25652
  180    40.23380    40.24113
  190    40.21221    40.21369
  200    40.19776    40.19875
  210    40.18832    40.18910
  220    40.17351    40.17434
  230    40.15931    40.16348
  240    40.14866    40.15063
  250    40.13485    40.13566
  260    40.12288    40.12600
  270    40.10429    40.10659
  280    40.09629    40.09709
  290    40.08405    40.08754
  300    40.07487    40.07673
  310    40.05887    40.05954
  320    40.04744    40.04813
  330    40.03846    40.04064
  340    40.02265    40.02560
  350    40.00962    40.00904
  360    39.99804    39.99839
  370    39.98773    39.98922
  380    39.97843    39.97995
  390    39.96942    39.97007
  400    39.96021    39.96120
  410    39.95186    39.95216
  420    39.94039    39.94100
  430    39.92925    39.92989
  440    39.92155    39.92227
  450    39.91296    39.91564
  460    39.90556    39.90583
  470    39.89841    39.90008
  480    39.89113    39.89139
  490    39.88425    39.88596
  500    39.87816    39.87871

In [8]:
%%bash
babel -ipdb 1_removed.pdb -omop 1_opt.mop -xk "PM6"
1 molecule converted
86 info messages 14 audit log messages 

In [12]:
%%bash
/home/preps/golovin/progs/bin/MOPAC2009.exe 1_opt.mop
##оптимизируем структуру с помощью MOPAC (удалив сначала лишние водороды)
In [13]:
%%bash
babel -imopout 1_opt.out -opdb 1_opt.pdb
1 molecule converted
23 audit log messages 

In [15]:
%%bash
/home/preps/golovin/progs/bin/MOPAC2009.exe 1_opt_spectr.mop
In [1]:
from xmlrpclib import ServerProxy
from IPython.display import Image
import os, sys
In [2]:
import __main__

__main__.pymol_argv = [ 'pymol', '-cp' ]



import pymol
 
pymol.finish_launching()
 
from pymol import cmd
In [3]:
from IPython.display import Image
In [3]:
cmd.delete('all')
cmd.load('1.pdb')
In [4]:
cmd.do('''
rotate x, 90
ray
png por1.png
''')
In [6]:
Image(filename='por1.png') 
##до MOPAC
Out[6]:
In [7]:
cmd.delete('all')
cmd.load('1_opt.pdb')
In [8]:
cmd.do('''
rotate x, 90
ray
png por1.png
''')
In [9]:
Image(filename='por1.png')
##после MOPAC, структура явно оптимизировалась и стала полностью плоской, как и должно быть
Out[9]:
In [18]:
%%bash
for i in 'SINGLET' 'DOUBLET' 'TRIPLET'
    do
    grep ${i} '1_opt_spectr.out' ##>> electron_states.txt
done
##достали из out-файла информацию об энергии перехода между состояниями
          TOTAL ENERGY            =      -3352.87886 EV  STATE:   1 SINGLET ????
    1+    0.000000    0.000000     1+  SINGLET     ????
    3     2.267356    2.267356     2   SINGLET     ????
    7     3.392490    3.392490     3   SINGLET     ????  0.2399  0.1995  0.0013
    8     3.669238    3.669238     4   SINGLET     ????  2.0363  2.3850  0.0129
    9     3.872141    3.872141     5   SINGLET     ????  1.8024  1.5312  0.0100
    2     1.914982    1.914982     1   TRIPLET     ????
    4     2.464879    2.464879     2   TRIPLET     ????
    5     2.826510    2.826510     3   TRIPLET     ????
    6     3.365178    3.365178     4   TRIPLET     ????

In [12]:
file = open('electron_states.txt', 'r')
energies = open('energies', 'w')
a=[]
for line in file:
    a.append(line.split()[1])
print(a)
outfile = open('energies', 'w')
outfile.write("\n".join(a))
['0.000000', '1.914982', '2.267356', '2.464879', '2.826510', '3.365178', '3.392490', '3.669238', '3.872141']

In [1]:
planck_constant = 4.135667*(10**(-15))
light_speed = 299.792458*(10**6)
lambdas=[]
file = open('energies', 'r')
for line in file:
    lambdas.append(planck_constant*light_speed*(10**9)/float(line))
print lambdas
##outfile = open('wavelenghts', 'w')
##outfile.write("\n".join(str(lambdas)))
##получили длины волн, которые способен поглащать порфирин, в нанометрах 
[647.4430440596758, 546.8227201195957, 503.00309889430116, 438.64758143416657, 368.43274721262475, 365.4665969242315, 337.9017047679889, 320.19541008436573]

In [3]:
%%bash
echo 'O=C1C=CC(=O)C=C1' >> new_mol.smi
In [4]:
%%bash
obgen new_mol.smi > new_mol.mol

A T O M   T Y P E S

IDX	TYPE
1	7
2	3
3	2
4	2
5	3
6	7
7	2
8	2
9	5
10	5
11	5
12	5

F O R M A L   C H A R G E S

IDX	CHARGE
1	0.000000
2	0.000000
3	0.000000
4	0.000000
5	0.000000
6	0.000000
7	0.000000
8	0.000000
9	0.000000
10	0.000000
11	0.000000
12	0.000000

P A R T I A L   C H A R G E S

IDX	CHARGE
1	-0.570000
2	0.541200
3	-0.135600
4	-0.135600
5	0.541200
6	-0.570000
7	-0.135600
8	-0.135600
9	0.150000
10	0.150000
11	0.150000
12	0.150000

S E T T I N G   U P   C A L C U L A T I O N S

SETTING UP BOND CALCULATIONS...
SETTING UP ANGLE & STRETCH-BEND CALCULATIONS...
SETTING UP TORSION CALCULATIONS...
SETTING UP OOP CALCULATIONS...
SETTING UP VAN DER WAALS CALCULATIONS...
SETTING UP ELECTROSTATIC CALCULATIONS...

S T E E P E S T   D E S C E N T

STEPS = 500

STEP n       E(n)         E(n-1)    
------------------------------------
    0      16.578      ----
   10     2.13094     2.31535
   20     0.68590     0.80368
   30    -0.08085     0.00722
   40    -0.28925    -0.28127
   50    -0.76995    -0.76399
   60    -0.94816    -0.94219
   70    -0.98337    -0.97925
   80    -1.00316    -0.99928
   90    -1.02857    -1.02531
  100    -1.04055    -1.03863
  110    -1.05610    -1.05563
    STEEPEST DESCENT HAS CONVERGED

W E I G H T E D   R O T O R   S E A R C H

  NUMBER OF ROTATABLE BONDS: 0
  NUMBER OF POSSIBLE ROTAMERS: 1
  GENERATED ONLY ONE CONFORMER


S T E E P E S T   D E S C E N T

STEPS = 500

STEP n       E(n)         E(n-1)    
------------------------------------
    0      -1.104      ----
   10    -1.10599    -1.10533
   20    -1.10647    -1.10682
   30    -1.10754    -1.10718
   40    -1.10821    -1.10802
   50    -1.10875    -1.10865
   60    -1.10868    -1.10915
   70    -1.10936    -1.10872
   80    -1.10984    -1.10950
   90    -1.11020    -1.11002
  100    -1.11049    -1.11039
  110    -1.11009    -1.11067
  120    -1.11059    -1.10990
  130    -1.11092    -1.11055
  140    -1.11115    -1.11095
  150    -1.11132    -1.11121
  160    -1.11067    -1.11139
  170    -1.11113    -1.11152
  180    -1.11141    -1.11095
  190    -1.11159    -1.11133
  200    -1.11171    -1.11156
  210    -1.11077    -1.11171
  220    -1.11128    -1.11181
  230    -1.11158    -1.11099
  240    -1.11176    -1.11142
  250    -1.11188    -1.11168
  260    -1.11195    -1.11183
  270    -1.11119    -1.11193
  280    -1.11156    -1.11200
  290    -1.11178    -1.11131
  300    -1.11192    -1.11164
  310    -1.11200    -1.11184
  320    -1.11205    -1.11196
  330    -1.11140    -1.11203
  340    -1.11171    -1.11103
  350    -1.11189    -1.11148
  360    -1.11199    -1.11176
  370    -1.11206    -1.11192
  380    -1.11111    -1.11202
  390    -1.11153    -1.11208
  400    -1.11179    -1.11121
  410    -1.11194    -1.11159
  420    -1.11204    -1.11183
  430    -1.11209    -1.11197
  440    -1.11125    -1.11205
  450    -1.11162    -1.11210
  460    -1.11185    -1.11133
  470    -1.11198    -1.11167
  480    -1.11206    -1.11188
  490    -1.11211    -1.11200
  500    -1.11137    -1.11207

In [9]:
cmd.delete('all')
cmd.load('new_mol.mol')
cmd.do('''
zoom visible
set valence, 2
ray
png new1.png
''')
In [10]:
Image(filename='new1.png')
Out[10]:
In [24]:
cmd.do('''
rotate x, 90
ray
png new2.png
''')
In [25]:
Image(filename='new2.png')
Out[25]:
In [26]:
cmd.save('quinone.pdb')
##obgen выдал плоскую молекулу
In [27]:
%%bash
babel -ipdb quinone.pdb -omop quinone_opt.mop -xk "PM6"
In [28]:
%%bash
export PATH=${PATH}:/home/preps/golovin/progs/bin
export MOPAC_LICENSE=/home/preps/golovin/progs/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/preps/golovin/progs/lib
MOPAC2009.exe quinone_opt.mop
MOPAC2009.exe quinone_charged_opt.mop
In [24]:
%%bash
babel -imopout quinone_opt.out -opdb quinone_opt.pdb
babel -imopout quinone_charged_opt.out -opdb quinone_charged_opt.pdb
In [7]:
cmd.delete('all')
cmd.load('quinone_opt.pdb')
cmd.do('''
refresh
zoom visible
set valence, 2
ray
png new3.png
''')
##MOPAC тоже выдал плоскую геометрию, но распознал ароматичнсоть в цикле
In [8]:
Image(filename='new3.png')
Out[8]:
In [19]:
cmd.delete('all')
cmd.load('quinone_opt.pdb')
cmd.do('''
refresh
zoom visible
rotate x, -90
rotate y, 90
show sticks
set stick_ball, on
set stick_ball_ratio, 2
set stick_radius, 0.12
set valence, 2
set ray_trace_mode, 3
ray
png new3.png
''')
In [21]:
Image(filename='new3.png')
Out[21]:
In [25]:
cmd.delete('all')
cmd.load('quinone_charged_opt.pdb')
cmd.do('''
zoom visible
rotate x, -90
rotate y, 90
show sticks
set stick_ball, on
set stick_ball_ratio, 2
set stick_radius, 0.12
set valence, 2
set ray_trace_mode, 3
ray
png new4.png
''')
##для дианиона ничего не изменилось
In [26]:
Image(filename='new4.png')
Out[26]:
In [27]:
cmd.delete('all')
cmd.load('quinone_charged_opt.pdb')
cmd.do('''
refresh
zoom visible
set valence, 2
ray
png new5.png
''')
In [28]:
Image(filename='new5.png')
Out[28]:
In []: