#!/usr/bin/env python -W ignore
'''
                 *** The command line interface for pyPczdump ***                                                                                                                                  
'''

import argh
from CoRe import pypczdump
														
#########################################################################################
#																						#
#									ENTRY POINT											#
#																						#
#########################################################################################

@argh.dispatch_command

# Mandatory command line arguments:
@argh.arg('-i','--input', nargs='*', required=True, type=str, help='''Input pczfile''')

# Optional command line arguments:
@argh.arg('-e','--evec', type=int, help='''Print the selected eigenvector.''')
@argh.arg('-f','--fluc', type=int, help='''Print the atomic fluctuations associated with the selected eigenvector.''')
@argh.arg('-l','--evals', action='store_true', help='''List the eigenvalues.''')
@argh.arg('-a','--avg', action='store_true', help='''Output the average structure in PDB format.''')
@argh.arg('-c','--coll', action='store_true', help='''Collectivity metric, K, for each eigenvector.
Modes producing most collective motion in the system will have high K values.''')
@argh.arg('-p','--proj', type=int, help='''Print the projections of each snapshot along the selected eigenvector.''')
@argh.arg('-n','--info', action='store_true', help='''Print  basic information out of the compressed file such as the number of atoms, of frames and of eigenvectors and the percent of the variance captured.''')
@argh.arg('-v','--verbosity', nargs='?', help="Increase output verbosity.")
@argh.arg('-o','--output', type=str, help='''Name of output file where the
information will be saved.''')
@argh.arg('--pdb', type=str, help='''Name of pdb reference file for use with --avg and --anim options.''')
@argh.arg('-r','--rms', type=int, help='''Print the rmsd of each frame in the intrajectory from the structure of the specified snapshot.''')
@argh.arg('-m','--anim', type=int, help='''Produce a PDB file animating the motion of the molecule along a specific eigenvector/principal component.''')

def main(**kwargs):
    class Struct(object):
        def __init__(self, entries):
            self.__dict__.update(entries)
    args = Struct(kwargs)
    pypczdump.pczdump(args)
