#  Copyright (C) 2017 The authors of Py-ChemShell
#
#  This file is part of Py-ChemShell.
#
#  Py-ChemShell is free software: you can redistribute it and/or modify
#  it under the terms of the GNU Lesser General Public License as
#  published by the Free Software Foundation, either version 3 of the
#  License, or (at your option) any later version.
#
#  Py-ChemShell is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with Py-ChemShell.  If not, see
#  <http://www.gnu.org/licenses/>.

from numpy  import float64, int64, zeros
from .      import Objects
from .xyz   import _XYZ
from ..io   import keyword

### FIXME: TWK run after run: overwritten?

class ResultBase(_XYZ):
    '''Result object containing energy, gradient, etc.'''

    _kwargs = {
                'natoms'     : 0,
                'znums'      : zeros(shape=(1,), dtype=int64),
              }

    _fields = 'znums'

    synons = { 'natoms':'npts' }
    _synons = {
                'natoms'     :'npts',
              }
                
        
    @property
    def gradients(self):
        '''Gradients'''

        return self._master.xyz


    @gradients.setter
    def gradients(self, val):
        '''Setter of gradients'''

        self._master.setField(val, field='xyz')


    @property
    def hessian(self):
        '''Hessian'''

        return self._master.hessian


    @hessian.setter
    def hessian(self, val):
        '''Setter of hessian'''

        self._master.setField(val, field='hessian')


    @property
    def potential(self):
        return self._master.potential


    @property
    def znums(self):
        '''Atomic numbers: (natoms,1)'''

        return self._master.znums


    @znums.setter
    @_XYZ._resize1D
    def znums(self, val):
        '''Setter of znums'''

        self._master.setField(val, field='znums')

