<commit_before>#ifndef IRC_WILSON_H
#define IRC_WILSON_H

#include "connectivity.h"

#include "../tools/constants.h"

#include <cmath>
#include <iostream>
#include <tuple>
#include <utility>

namespace wilson{

template <typename Vector3>
std::pair<Vector3,Vector3> bond_gradient(const connectivity::Bond<Vector3>& b){
  Vector3 v{ (b.p1 - b.p2) / b.bond };
  
  return {-v, v};
}

template <typename Vector3>
std::tuple<Vector3, Vector3, Vector3> angle_gradient(const connectivity::Angle<Vector3>& a){
  double angle_rad{ a.angle / 180. * tools::constants::pi};
  
  // TODO: Check pyberny for more robust implementations
  
  double sin_angle{ std::sin(angle_rad) };
  double cos_angle{ std::cos(angle_rad) };
  
  Vector3 b21{ a.p1 - a.p2 };
  Vector3 b23{ a.p3 - a.p2 };
  <commit_msg>Corrected order in bond gradient<commit_after>#ifndef IRC_WILSON_H
#define IRC_WILSON_H

#include "connectivity.h"

#include "../tools/constants.h"

#include <cmath>
#include <iostream>
#include <tuple>
#include <utility>

namespace wilson{

template <typename Vector3>
std::pair<Vector3,Vector3> bond_gradient(const connectivity::Bond<Vector3>& b){
  Vector3 v{ (b.p1 - b.p2) / b.bond };
  
  return {v, -v};
}

template <typename Vector3>
std::tuple<Vector3, Vector3, Vector3> angle_gradient(const connectivity::Angle<Vector3>& a){
  double angle_rad{ a.angle / 180. * tools::constants::pi};
  
  // TODO: Check pyberny for more robust implementations
  
  double sin_angle{ std::sin(angle_rad) };
  double cos_angle{ std::cos(angle_rad) };
  
  Vector3 b21{ a.p1 - a.p2 };
  Vector3 b23{ a.p3 - a.p2 };
  
{'fraction_non_alphanumeric': 0.14652473387601753, 'fraction_numerical': 0.031308703819661866, 'mean_word_length': 4.607017543859649, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4246443', 'n_tokens_mistral': 623, 'n_tokens_neox': 596, 'n_words': 140}