#include "Angle_energy_CT_CT_HC_amber.h"

//#include "Geometry_util.h"
#include "Geometry.h"
#include "Atom.h"
#include <cmath>

namespace MM
{

double Angle_energy_CT_CT_HC_amber::handle_value() const
{
    //CT    CT	HC	50.0	109.50	changed	based	on	NMA	nmodes
    /*double ve1[3], ve2[3];

    ve1[0] = atom1_.x() - atom2_.x();
    ve1[1] = atom1_.y() - atom2_.y();
    ve1[2] = atom1_.z() - atom2_.z();

    ve2[0] = atom3_.x() - atom2_.x();
    ve2[1] = atom3_.y() - atom2_.y();
    ve2[2] = atom3_.z() - atom2_.z();


    double cos_angle = Geometry_util::cos_by_vectors (ve1,ve2);
    double angle	 = acos(cos_angle);//*/

    double ang = angle (atom1_, atom2_, atom3_);

    double angle_0	 = (109.50 / 180) * 3.14159265358979323846;
	double result	 = 50.0 * (ang - angle_0) * (ang - angle_0);

    return result;
}

Angle_energy_CT_CT_HC_amber::
Angle_energy_CT_CT_HC_amber 
    (const Atom & atom1, const Atom & atom2, const Atom & atom3)
:
    atom1_(atom1), atom2_(atom2), atom3_(atom3)
{
}

}//MM
