Skip to content

Commit 1a0d538

Browse files
committed
add exporter for ORCA-6 input file
1 parent 1947fb2 commit 1a0d538

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

GSASII/exports/G2export_PDB.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,58 @@ def Exporter(self,event=None):
232232
self.CloseFile()
233233
print('Phase '+phasenam+' written to XYZ file '+self.fullpath)
234234

235+
class ExportPhaseCartXYZ(G2fil.ExportBaseclass):
236+
'''Used to create a basic ORCA6 Cartesian inp file for a phase
237+
238+
:param wx.Frame G2frame: reference to main GSAS-II frame
239+
'''
240+
def __init__(self,G2frame):
241+
super(self.__class__,self).__init__( # fancy way to say <parentclass>.__init__
242+
G2frame=G2frame,
243+
formatName = 'ORCA Cartesian inp',
244+
extension='.inp',
245+
longFormatName = 'Export phase with basic ORCA Cartesian coordinates as .inp file'
246+
)
247+
self.exporttype = ['phase']
248+
self.multiple = True
249+
250+
def Exporter(self,event=None):
251+
'''Export as a XYZ file
252+
'''
253+
# the export process starts here
254+
self.InitExport(event)
255+
# load all of the tree into a set of dicts
256+
self.loadTree()
257+
# create a dict with refined values and their uncertainties
258+
self.loadParmDict()
259+
if self.ExportSelect(): # set export parameters; ask for file name
260+
return
261+
filename = self.filename
262+
self.OpenFile()
263+
for phasenam in self.phasenam:
264+
phasedict = self.Phases[phasenam] # pointer to current phase info
265+
General = phasedict['General']
266+
i = self.Phases[phasenam]['pId']
267+
Atoms = phasedict['Atoms']
268+
if not len(Atoms):
269+
print('**** ERROR - Phase '+phasenam+' has no atoms! ****')
270+
continue
271+
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+
cx,ct,cs,cia = General['AtomPtrs']
274+
Cell = General['Cell'][1:7]
275+
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')
279+
fmt = '{:4s}'+3*'{:12.4f}'
280+
for atom in Atoms:
281+
xyz = np.inner(A,np.array(atom[cx:cx+3]))
282+
self.Write(fmt.format(atom[ct],*xyz))
283+
self.Write('*\n')
284+
self.CloseFile()
285+
print('Phase '+phasenam+' written to ORCA inp file '+self.fullpath)
286+
235287
class ExportDrawPhaseCartXYZ(G2fil.ExportBaseclass):
236288
'''Used to create a Cartesian XYZ file for a phase draw atoms
237289

0 commit comments

Comments
 (0)