#include "MM_energy_calculation.h"

#include "Atom.h"
#include "Bond.h"
#include "Array_of_own.h"

namespace MM
{

MM_energy_calculation::
MM_energy_calculation (Atom_group & atoms, 
                       Array_of <Bond> & bonds)
//MM_energy_calculation::MM_energy_calculation( Atoms & atoms, Bonds & bonds,
//MM_energy & energy )
: atoms_(atoms), bonds_(bonds)//, energy_( energy )
{/*
//    Collection_of_objects< MM_bond_length > bond_lengths;
    Array_of_dynamic_objects< MM_bond_length > * bond_lengths
        = new Array_of_dynamic_objects< MM_bond_length >;

    for( int i=0;  i<bonds_.size();  ++i )
    {
        Bond & current = bonds_[i];
        CHECK( "Two centers bond", current.atoms().size() == 2 );

        //current.atoms()[0];
        MM_atom & atom1 = current.atoms()[0];

        //current.atoms()[1];
        MM_atom & atom2 = current.atoms()[1];

        double force_constant       = 7; //fix
        double equilibrium_distance = 1.4; //fix

        MM_bond_length *new_bond_length = new
        MM_bond_length( atom1, atom2, force_constant, equilibrium_distance );

        bond_lengths->push_back( new_bond_length );
    }
                                                //!!!!!!!!!!!!!!!!!
    energy_.adopt( new Test_MM_energy( bond_lengths ) );//*/
}

double MM_energy_calculation::
value () const
{
    return energy_().value();
    //    return energy.value( atoms_, bonds_ );
}

}//MM
