VNL转Gaussian脚本 | 寒山烟雨
现在的位置: 首页 > 滴水穿石 > 正文

VNL转Gaussian脚本

2013年11月01日 滴水穿石 ⁄ 共 8352字 ⁄ 字号 暂无评论 ⁄ 阅读 1,922 views 次

最近在用高斯算分子结构,VNL文件手动改成Gaussian文件各种痛苦,手动写了一个转换脚本,把原子结构和坐标复制进去就可以了。

 Python | 
 
 copy code |
?

001
def Transfer(elements,coordinates):
002
    f=open("data.gjf","w")
003
    f.write('%chk=data.chk\n%mem=8GB\n%nproc=4\n#\n\nTitle\n\n0 1\n')
004
    Temp='  ';
005
    n=len(elements)
006
    for i in range(n):      
007
        f.write(elements[i])
008
        f.write(Temp)
009
        f.write(str(coordinates[i][0]))
010
        f.write(Temp)
011
        f.write(str(coordinates[i][1]))
012
        f.write(Temp)
013
        f.write(str(coordinates[i][2]))
014
        f.write('\n')
015
    f.close()
016
 
017
Carbon='C'
018
Hydrogen='H'
019
Iron='Fe'
020
Gold='Au'
021
Nitrogen='N'
022
Sulfur='S'
023
 
024
 
025
# Scattering elements and coordinates
026
elements=[Gold,     Gold,     Gold,     Gold,     
027
                       Gold,     Gold,     Gold,     Gold,     
028
                       Gold,     Gold,     Gold,     Gold,     
029
                       Gold,     Gold,     Gold,     Gold,     
030
                       Gold,     Gold,     Gold,     Gold,     
031
                       Gold,     Gold,     Gold,     Gold,     
032
                       Gold,     Gold,     Gold,     Gold,
033
                       Gold,     Gold,     Gold,     Gold,     
034
                       Gold,     Gold,     Gold,     Gold,     
035
                       Gold,     Gold,     Gold,     Gold,     
036
                       Gold,     Gold,     Gold,     Gold,     
037
                       Gold,     Gold,     Gold,     Gold,      
038
                       Gold,     Gold,     Gold,     Gold,
039
                       Carbon,   Carbon,   Carbon,   Carbon,   
040
                       Carbon,   Nitrogen, Carbon,   Carbon,   
041
                       Nitrogen, Carbon,   Carbon,   Carbon,   
042
                       Carbon,   Carbon,   Carbon,   Carbon,   
043
                       Carbon,   Nitrogen, Carbon,   Carbon,   
044
                       Nitrogen, Carbon,   Carbon,   Carbon,   
045
                       Carbon,   Carbon,   Carbon,   Carbon,   
046
                       Carbon,   Carbon,   Carbon,   Carbon,   
047
                       Carbon,   Carbon,   Carbon,   Carbon,   
048
                       Hydrogen, Hydrogen, Hydrogen, Hydrogen, 
049
                       Hydrogen, Hydrogen, Hydrogen, Hydrogen, 
050
                       Hydrogen, Hydrogen, Sulfur,   Hydrogen, 
051
                       Hydrogen, Hydrogen, Hydrogen, Hydrogen, 
052
                       Hydrogen, Sulfur,   Hydrogen, Hydrogen, 
053
                       Hydrogen, Hydrogen, Gold,    Gold,
054
                       Gold,     Gold,     Gold,     Gold,     
055
                       Gold,     Gold,     Gold,     Gold,     
056
                       Gold,     Gold,     Gold,     Gold,     
057
                       Gold,     Gold,     Gold,     Gold,     
058
                       Gold,     Gold,     Gold,     Gold,     
059
                       Gold,     Gold,     Gold,     Gold,     
060
                       Gold,     Gold,     Gold,     Gold,     
061
                       Gold,     Gold,     Gold,     Gold,
062
                       Gold,     Gold]  
063
 
064
 
065
 
066
## Scattering coordinates
067
coordinates=[[  0.00000000e+00,   0.00000000e+00,   4.70886880e+00],
068
                          [  4.44089210e-16,   1.66483653e+00,   7.06330329e+00],
069
                          [ -1.44179070e+00,   2.49725485e+00,   4.70886880e+00],
070
                          [ -1.44179070e+00,   4.16209126e+00,   7.06330329e+00],
071
                          [ -2.88358140e+00,   4.99450970e+00,   4.70886880e+00],
072
                          [ -2.88358140e+00,   6.65934610e+00,   7.06330329e+00],
073
                          [ -4.32537222e+00,   7.49176455e+00,   4.70886880e+00],
074
                          [ -4.32537222e+00,   9.15660095e+00,   7.06330329e+00],
075
                          [  2.88358140e+00,   0.00000000e+00,   4.70886880e+00],
076
                          [  2.88358140e+00,   1.66483653e+00,   7.06330329e+00],
077
                          [  1.44179070e+00,   2.49725485e+00,   4.70886880e+00],
078
                          [  1.44179070e+00,   4.16209126e+00,   7.06330329e+00],
079
                          [ -9.99999994e-09,   4.99450970e+00,   4.70886880e+00],
080
                          [ -9.99999905e-09,   6.65934610e+00,   7.06330329e+00],
081
                          [ -1.44179070e+00,   7.49176455e+00,   4.70886880e+00],
082
                          [ -1.44179070e+00,   9.15660095e+00,   7.06330329e+00],
083
                          [  5.76716280e+00,   0.00000000e+00,   4.70886880e+00],
084
                          [  5.76716280e+00,   1.66483653e+00,   7.06330329e+00],
085
                          [  4.32537222e+00,   2.49725485e+00,   4.70886880e+00],
086
                          [  4.32537222e+00,   4.16209126e+00,   7.06330329e+00],
087
                          [  2.88358140e+00,   4.99450970e+00,   4.70886880e+00],
088
                          [  2.88358140e+00,   6.65934610e+00,   7.06330329e+00],
089
                          [  1.44179070e+00,   7.49176455e+00,   4.70886880e+00],
090
                          [  1.44179070e+00,   9.15660095e+00,   7.06330329e+00],
091
                          [  8.65074444e+00,   0.00000000e+00,   4.70886880e+00],
092
                          [  8.65074444e+00,   1.66483653e+00,   7.06330329e+00],
093
                          [  7.20895386e+00,   2.49725485e+00,   4.70886880e+00],
094
                          [  7.20895386e+00,   4.16209126e+00,   7.06330329e+00],
095
                          [  5.76716280e+00,   4.99450970e+00,   4.70886880e+00],
096
                          [  5.76716280e+00,   6.65934610e+00,   7.06330329e+00],
097
                          [  4.32537222e+00,   7.49176455e+00,   4.70886880e+00],
098
                          [  4.32537222e+00,   9.15660095e+00,   7.06330329e+00],
099
                          [  0.00000000e+00,   0.00000000e+00,   9.41773778e+00],
100
                          [ -1.44179070e+00,   2.49725485e+00,   9.41773778e+00],
101
                          [ -2.88358140e+00,   4.99450970e+00,   9.41773778e+00],
102
                          [ -4.32537222e+00,   7.49176455e+00,   9.41773778e+00],
103
                          [  2.88358140e+00,   0.00000000e+00,   9.41773778e+00],
104
                          [  1.44179070e+00,   2.49725485e+00,   9.41773778e+00],
105
                          [ -9.99999994e-09,   4.99450970e+00,   9.41773778e+00],
106
                          [ -1.44179070e+00,   7.49176455e+00,   9.41773778e+00],
107
                          [  5.76716280e+00,   0.00000000e+00,   9.41773778e+00],
108
                          [  4.32537222e+00,   2.49725485e+00,   9.41773778e+00],
109
                          [  2.88358140e+00,   4.99450970e+00,   9.41773778e+00],
110
                          [  1.44179070e+00,   7.49176455e+00,   9.41773778e+00],
111
                          [  8.65074444e+00,   0.00000000e+00,   9.41773778e+00],
112
                          [  7.20895386e+00,   2.49725485e+00,   9.41773778e+00],
113
                          [  5.76716280e+00,   4.99450970e+00,   9.41773778e+00],
114
                          [  4.32537222e+00,   7.49176455e+00,   9.41773778e+00],
115
                          [  0.00000000e+00,   6.65934992e+00,   1.17721689e+01],
116
                          [  2.88357997e+00,   6.65934992e+00,   1.17721689e+01],
117
                          [  1.44178998e+00,   4.16208982e+00,   1.17721689e+01],
118
                          [  1.44178998e+00,   5.82693005e+00,   1.41265991e+01],
119
                          [  1.61401999e+00,   3.11600018e+00,   2.49839953e+01],
120
                          [  1.65762007e+00,   2.55208015e+00,   2.62577971e+01],
121
                          [  1.64859998e+00,   3.17923999e+00,   2.75078962e+01],
122
                          [  1.53460014e+00,   3.31410003e+00,   2.27212961e+01],
123
                          [  1.58970010e+00,   2.40047002e+00,   2.37421969e+01],
124
                          [  1.58231008e+00,   4.45072985e+00,   2.46654966e+01],
125
                          [  1.73837006e+00,   2.43069005e+00,   2.87551954e+01],
126
                          [  1.70816004e+00,   3.34712005e+00,   2.97537954e+01],
127
                          [  1.56146991e+00,   4.51820993e+00,   2.77460955e+01],
128
                          [  1.48399007e+00,   5.87482977e+00,   2.26534956e+01],
129
                          [  1.44935000e+00,   7.10873985e+00,   2.33438967e+01],
130
                          [  1.53741014e+00,   4.62734985e+00,   2.33025969e+01],
131
                          [  1.41015995e+00,   8.58279991e+00,   2.49410971e+01],
132
                          [  1.38249004e+00,   9.20921993e+00,   2.61912954e+01],
133
                          [  1.40069997e+00,   8.64422989e+00,   2.74652956e+01],
134
                          [  1.45685995e+00,   8.41913986e+00,   2.26945971e+01],
135
                          [  1.42400014e+00,   9.33553028e+00,   2.36931971e+01],
136
                          [  1.42989004e+00,   7.24107981e+00,   2.47032965e+01],
137
                          [  1.33337009e+00,   9.35589981e+00,   2.87076967e+01],
138
                          [  1.36664999e+00,   8.44125938e+00,   2.97285956e+01],
139
                          [  1.48279011e+00,   7.31153965e+00,   2.77833956e+01],
140
                          [  1.47015011e+00,   7.13243961e+00,   2.91465967e+01],
141
                          [  1.52854002e+00,   5.88519001e+00,   2.97956961e+01],
142
                          [  1.58622992e+00,   4.65224981e+00,   2.91051958e+01],
143
                          [  1.40487993e+00,   5.86722994e+00,   1.83322981e+01],
144
                          [  3.30520004e-01,   6.39085007e+00,   1.90617979e+01],
145
                          [  3.62600058e-01,   6.39199972e+00,   2.04547976e+01],
146
                          [  1.45944011e+00,   5.87400007e+00,   2.11608961e+01],
147
                          [  2.52909994e+00,   5.35194969e+00,   2.04153975e+01],
148
                          [  2.50734997e+00,   5.34707975e+00,   1.90231970e+01],
149
                          [  1.52636993e+00,   5.88487005e+00,   3.12885969e+01],
150
                          [  4.84969944e-01,   5.28101969e+00,   3.20121954e+01],
151
                          [  4.76579994e-01,   5.28035975e+00,   3.34042967e+01],
152
                          [  1.51823008e+00,   5.88866997e+00,   3.41175955e+01],
153
                          [  2.56346989e+00,   6.49469995e+00,   3.34102972e+01],
154
                          [  2.56219006e+00,   6.49029970e+00,   3.20166967e+01],
155
                          [  1.70467007e+00,   1.46648991e+00,   2.62720965e+01],
156
                          [  1.48803008e+00,   3.11226010e+00,   2.16614969e+01],
157
                          [  1.60194004e+00,   1.32142997e+00,   2.36614969e+01],
158
                          [  1.82535994e+00,   1.35383999e+00,   2.88354967e+01],
159
                          [  1.77306998e+00,   3.17348003e+00,   3.08184965e+01],
160
                          [  1.34008014e+00,   1.02950296e+01,   2.61769961e+01],
161
                          [  1.49588001e+00,   8.59688950e+00,   2.16292971e+01],
162
                          [  1.42235005e+00,   1.04158297e+01,   2.36124971e+01],
163
                          [  1.25762999e+00,   1.04323301e+01,   2.87887953e+01],
164
                          [  1.31677997e+00,   8.63879967e+00,   3.07890967e+01],
165
                          [  1.44178998e+00,   5.82693005e+00,   1.65465983e+01],
166
                          [ -5.38360000e-01,   6.79343987e+00,   1.85479982e+01],
167
                          [ -4.83530015e-01,   6.79189968e+00,   2.10061968e+01],
168
                          [  3.39748001e+00,   4.95776987e+00,   2.09354971e+01],
169
                          [  3.35413980e+00,   4.94447994e+00,   1.84737986e+01],
170
                          [ -3.35060030e-01,   4.81481981e+00,   3.14737967e+01],
171
                          [ -3.46239954e-01,   4.81056976e+00,   3.39363974e+01],
172
                          [  1.44331992e+00,   5.85095978e+00,   3.59021986e+01],
173
                          [  3.38628006e+00,   6.96559000e+00,   3.39415968e+01],
174
                          [  3.38789988e+00,   6.95269966e+00,   3.14831961e+01],
175
                          [  1.56031001e+00,   5.23467970e+00,   2.53133963e+01],
176
                          [  1.51687992e+00,   6.52804995e+00,   2.71353968e+01],
177
                          [ 0.00000000e+00,   6.65934992e+00,   4.06766279e+01],
178
                          [  1.44178998e+00,   4.16208982e+00,   4.06766279e+01],
179
                          [  2.88357997e+00,   6.65934992e+00,   4.06766279e+01],
180
                          [  1.44178998e+00,   5.82693005e+00,   3.83222006e+01],
181
                          [  0.00000000e+00,   0.00000000e+00,   4.30333021e+01],
182
                          [  4.44089210e-16,   1.66483653e+00,   4.53877371e+01],
183
                          [ -1.44179070e+00,   2.49725485e+00,   4.30333021e+01],
184
                          [ -1.44179070e+00,   4.16209126e+00,   4.53877371e+01],
185
                          [ -2.88358140e+00,   4.99450970e+00,   4.30333021e+01],
186
                          [ -2.88358140e+00,   6.65934610e+00,   4.53877371e+01],
187
                          [ -4.32537222e+00,   7.49176455e+00,   4.30333021e+01],
188
                          [ -4.32537222e+00,   9.15660095e+00,   4.53877371e+01],
189
                          [  2.88358140e+00,   0.00000000e+00,   4.30333021e+01],
190
                          [  2.88358140e+00,   1.66483653e+00,   4.53877371e+01],
191
                          [  1.44179070e+00,   2.49725485e+00,   4.30333021e+01],
192
                          [  1.44179070e+00,   4.16209126e+00,   4.53877371e+01],
193
                          [ -9.99999994e-09,   4.99450970e+00,   4.30333021e+01],
194
                          [ -9.99999905e-09,   6.65934610e+00,   4.53877371e+01],
195
                          [ -1.44179070e+00,   7.49176455e+00,   4.30333021e+01],
196
                          [ -1.44179070e+00,   9.15660095e+00,   4.53877371e+01],
197
                          [  5.76716280e+00,   0.00000000e+00,   4.30333021e+01],
198
                          [  5.76716280e+00,   1.66483653e+00,   4.53877371e+01],
199
                          [  4.32537222e+00,   2.49725485e+00,   4.30333021e+01],
200
                          [  4.32537222e+00,   4.16209126e+00,   4.53877371e+01],
201
                          [  2.88358140e+00,   4.99450970e+00,   4.30333021e+01],
202
                          [  2.88358140e+00,   6.65934610e+00,   4.53877371e+01],
203
                          [  1.44179070e+00,   7.49176455e+00,   4.30333021e+01],
204
                          [  1.44179070e+00,   9.15660095e+00,   4.53877371e+01],
205
                          [  8.65074444e+00,   0.00000000e+00,   4.30333021e+01],
206
                          [  8.65074444e+00,   1.66483653e+00,   4.53877371e+01],
207
                          [  7.20895386e+00,   2.49725485e+00,   4.30333021e+01],
208
                          [  7.20895386e+00,   4.16209126e+00,   4.53877371e+01],
209
                          [  5.76716280e+00,   4.99450970e+00,   4.30333021e+01],
210
                          [  5.76716280e+00,   6.65934610e+00,   4.53877371e+01],
211
                          [  4.32537222e+00,   7.49176455e+00,   4.30333021e+01],
212
                          [  4.32537222e+00,   9.15660095e+00,   4.53877371e+01]]
213
 
214
Transfer(elements,coordinates)
215

0

给我留言

留言无头像?


×