# Path: vasppy/grid.py
# def interpolate( i, j, x ):
# def trilinear_interpolation( cube, r ):
#     def __init__( self, dimensions = [ 1, 1, 1 ] ):
#     def read_from_filename( self, filename ):
#     def write_to_filename( self, filename ):
#     def read_dimensions( self ):
#     def write_dimensions( self ):
#     def read_grid( self ):
#     def write_grid( self ):
#     def average( self, normal_axis_label ):
#     def by_index( self, index ):
#     def fractional_coordinate_at_index( self, index ):      
#     def cartesian_coordinate_at_index( self, index ):
#     def cube_slice( self, x0, y0, z0 ):
#     def interpolated_value_at_fractional_coordinate( self, coord ):
#     def interpolate_to_orthorhombic_grid( self, dimensions ): # warning. This may need a more robust minimim image function in Cell.py for highly non-orthorhombic cells
# class Grid:


from vasppy import grid
import argparse
#! /usr/bin/env python3


def parse_command_line_arguments():
    # command line arguments
    parser = argparse.ArgumentParser( description='z-projection of a VASP (grid format) file' )
    parser.add_argument( 'gridfile', help="filename of the VASP (grid format) file to be processed" )
    parser.add_argument( '-p', '--projection', choices=[ 'x', 'y', 'z' ], help="output averaged projection perpendicular to [x,y,z]" )
    parser.add_argument( '-o', '--orthorhombic', help='map grid points onto an orthorhombic (non-space filling) grid', action = 'store_true' )
    args = parser.parse_args()
    return args

def main():
    args = parse_command_line_arguments()
    vgrid = grid.Grid()
    vgrid.read_from_filename( args.gridfile )
    if args.orthorhombic:
        vgrid = vgrid.interpolate_to_orthorhombic_grid( vgrid.dimensions )
    if args.projection:

# Path: vasppy/grid.py
# def interpolate( i, j, x ):
# def trilinear_interpolation( cube, r ):
#     def __init__( self, dimensions = [ 1, 1, 1 ] ):
#     def read_from_filename( self, filename ):
#     def write_to_filename( self, filename ):
#     def read_dimensions( self ):
#     def write_dimensions( self ):
#     def read_grid( self ):
#     def write_grid( self ):
#     def average( self, normal_axis_label ):
#     def by_index( self, index ):
#     def fractional_coordinate_at_index( self, index ):      
#     def cartesian_coordinate_at_index( self, index ):
#     def cube_slice( self, x0, y0, z0 ):
#     def interpolated_value_at_fractional_coordinate( self, coord ):
#     def interpolate_to_orthorhombic_grid( self, dimensions ): # warning. This may need a more robust minimim image function in Cell.py for highly non-orthorhombic cells
# class Grid:


# Path: vasppy/scripts/vasp_grid.py
from vasppy import grid
import argparse

#! /usr/bin/env python3


def parse_command_line_arguments():
    # command line arguments
    parser = argparse.ArgumentParser( description='z-projection of a VASP (grid format) file' )
    parser.add_argument( 'gridfile', help="filename of the VASP (grid format) file to be processed" )
    parser.add_argument( '-p', '--projection', choices=[ 'x', 'y', 'z' ], help="output averaged projection perpendicular to [x,y,z]" )
    parser.add_argument( '-o', '--orthorhombic', help='map grid points onto an orthorhombic (non-space filling) grid', action = 'store_true' )
    args = parser.parse_args()
    return args

def main():
    args = parse_command_line_arguments()
    vgrid = grid.Grid()
    vgrid.read_from_filename( args.gridfile )
    if args.orthorhombic:
        vgrid = vgrid.interpolate_to_orthorhombic_grid( vgrid.dimensions )
    if args.projection:

        index = grid.Grid.projections[ args.projection ]