def main( self ): (options, args) = self.opt_parser.parse_args() input_name = options.input_name output_name = options.output_name direct = options.direct sysopts = { "verbose" : self.verbose, "debug" : self.debug } try: input_file = FileIO( input_name,'POSCAR', "r", sysopts ) except Exception as ex: print 'Error: ' + str( ex ) # end try input_file.read() geom = input_file.geom() # geom.check() position_type = PositionTypes.Cart if direct: position_type = PositionTypes.Direct # end if try: output_file = FileIO( output_name,'POSCAR', "w+", sysopts ) output_file.geom( geom ) output_file.write( { 'position_type' : position_type } ) except Exception as ex: print 'Error: ' + str( ex )
def write_geom( name = "output", sysopts = { "verbose" : False, "debug" : False }, geom = None, position_type = PositionTypes.Cart ): output = FileIO( name + ".xyz",'xyz', "w+", sysopts ) output.geom( geom ) output.write() output = FileIO( name + ".POSCAR",'POSCAR', "w+", sysopts ) output.geom( geom ) output.write( { "position_type" : position_type } )
def main( self ): (opts, args) = self.parse() sysopts = { "verbose" : self.verbose, "debug" : self.debug } a = string.atof(opts.amin) b = string.atof(opts.bsub) # read inputs min_file = FileIO( opts.min_name, 'CHGCAR', "r", sysopts ) min_file.read() sub_file = FileIO( opts.sub_name, 'CHGCAR', "r", sysopts ) sub_file.read() min_file.command('add', { 's': sub_file, 'a' : a, 'b' : b} ) min_file.handler.path = 'diff.CHGCAR' min_file.handler.opts = 'w+' min_file.handler.buffer = min_file.handler.obuffer min_file.write( { 'diff' : True } )