Skip to content

Commit e775d3d

Browse files
committed
new exporter for ORCA input file. Simple start with built in output from ORCA
1 parent 1a0d538 commit e775d3d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

GSASII/exports/G2export_PDB.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ def Exporter(self,event=None):
259259
if self.ExportSelect(): # set export parameters; ask for file name
260260
return
261261
filename = self.filename
262+
Oname = os.path.splitext(filename)[0]
262263
self.OpenFile()
263264
for phasenam in self.phasenam:
264265
phasedict = self.Phases[phasenam] # pointer to current phase info
@@ -269,18 +270,23 @@ def Exporter(self,event=None):
269270
print('**** ERROR - Phase '+phasenam+' has no atoms! ****')
270271
continue
271272
if len(self.phasenam) > 1: # if more than one filename is included, add a phase #
272-
self.filename = os.path.splitext(filename)[1] + "_" + str(i) + self.extension
273+
self.filename = Oname + "_" + str(i) + self.extension
273274
cx,ct,cs,cia = General['AtomPtrs']
274275
Cell = General['Cell'][1:7]
275276
A,B = G2lat.cell2AB(Cell)
276-
self.Write('# GSAS-II generated ORCA input file\n# Basic Mode\n#')
277-
self.Write('#! BLYP SVP Opt #use for simple optimization')
278-
self.Write('! RHF SP def2-SVP\n\n* xyz 0 1')
277+
self.Write('# GSAS-II generated ORCA input file\n# Basic Mode')
278+
self.Write('# after xyz is charge & multiplicity; change as needed')
279+
self.Write('* xyz 0 1')
279280
fmt = '{:4s}'+3*'{:12.4f}'
280281
for atom in Atoms:
281282
xyz = np.inner(A,np.array(atom[cx:cx+3]))
282283
self.Write(fmt.format(atom[ct],*xyz))
283-
self.Write('*\n')
284+
self.Write('*\n%%Compound\nGeometry %s;\nVariable Optimize = 0;\nVariable CC;'%Oname)
285+
self.Write('if (Optimize=0) then\n New_Step\n ! RHF SP def2-SVP\n Step_End')
286+
self.Write('else\n New_Step\n ! BLYP SVP Opt\n Step_End\nEndIf')
287+
self.Write('%s.Read();'%Oname)
288+
self.Write('%s.WriteXYZFile(filename="%s_ORCA.xyz");'%(Oname,Oname))
289+
self.Write('End')
284290
self.CloseFile()
285291
print('Phase '+phasenam+' written to ORCA inp file '+self.fullpath)
286292

0 commit comments

Comments
 (0)