Example #1
0
  def main( self ):
    (options, args) = self.opt_parser.parse_args()
    input_name  = options.input_name
    output_name = options.output_name
    trans_name  = options.trans_name
    direct = options.direct
    
    sysopts = { "verbose" : self.verbose, "debug" : self.debug }

    # position type
    position_type = PositionTypes.Cart
    if direct:
      position_type = PositionTypes.Direct
    # end if

    # read inputs
    try:
      input_file = FileIO( input_name, 'POSCAR', "r", sysopts )
    except Exception as ex:
      print ' Error: ' + str( ex )
      return 0
    # end try
    input_file.read()
    geom = input_file.geom()

    try:
      trans = Transform()
      trans.build()
      trans.process( trans_name, geom )
    except Exception as ex:
      print ' No transformation: ' + str( ex )
      if self.verbose:
        raise
    # end try
    
    geom.gen_species()
    geom.order()
    write_geom( output_name, sysopts, geom, position_type )
Example #2
0
  def main( self ):
    (options, args) = self.opt_parser.parse_args()
    input_files_arr = {}
    input_arr = {}
    input_files = options.input_files
    output_name = options.output_name
    trans_name  = options.trans_name
    direct = options.direct
    
    merge_geom = Geometry( 'Merge' )
    merge_geom.position_type = PositionTypes.Cart

    try:
      for inp in input_files.split( "," ):
        ( sym, input_file ) = inp.split( ":" )
        input_files_arr[sym] = input_file
      # end for
    except Exception as ex:
      print ' Error: ' + str( ex )
      return 0
    # end try

    sysopts = { "verbose" : self.verbose, "debug" : self.debug }
    # read inputs
    for inp in input_files_arr:
      sym = inp
      input_file = input_files_arr[inp]
      try:
        input_arr[sym] = FileIO( input_file, 'SCCOUT', "r", sysopts )
      except Exception as ex:
        print ' Error: ' + str( ex )
        return 0
      # end try
      input_arr[sym].handler.set( 'global_specie', sym )
      input_arr[sym].read()

      geom = input_arr[sym].geom()
      geom.name = input_file
      # geom.check()
      try:
        verbose = merge_geom.merge( geom, True, False )
        if self.verbose:
          print verbose
      except Exception as ex:
        print ' Error: ' + str( ex )
        return 0
      # end try
    # end for


    position_type = PositionTypes.Cart
    if direct:
      position_type = PositionTypes.Direct
    # end if

    # # merge check
    # merge_geom.wignercell()
    # # write out check geoms
    merge_geom.order()
    write_geom( output_name, sysopts, merge_geom, position_type )

    try:
      trans = Transform()
      trans.build()
      trans.process( trans_name, merge_geom )
    except Exception as ex:
      print str( ex )
      #if self.verbose:
        # raise
    # end try

    write_geom( output_name + ".transform", sysopts, merge_geom, position_type )