10 #include "../utils/map_to_index.h" 29 check_required_keys({
"atom1-id",
"atom2-id",
"atom3-id",
"atom4-id"});
33 el_atoms->check_required_keys({
"id",
"xu",
"yu",
"zu"});
38 el_atoms->make_2darray_from_data(rs_atom, {
"xu",
"yu",
"zu"});
40 const double rad2deg = 180.0 / M_PI;
44 RowVector3d r1 = rs_atom.row(id2index_atom[d[
"atom1-id"]]);
45 RowVector3d r2 = rs_atom.row(id2index_atom[d[
"atom2-id"]]);
46 RowVector3d r3 = rs_atom.row(id2index_atom[d[
"atom3-id"]]);
47 RowVector3d r4 = rs_atom.row(id2index_atom[d[
"atom4-id"]]);
49 auto vec_1to2 = r2 - r1;
50 auto vec_2to3 = r3 - r2;
51 auto vec_3to4 = r4 - r3;
53 auto n123 = vec_1to2.cross(vec_2to3);
54 auto n234 = vec_2to3.cross(vec_3to4);
56 d[
"dihedral-angle"] = rad2deg * acos(
57 n123.dot(n234) / (n123.norm() * n234.norm()));
This file has a definition of AddDihedralAngle class, which is a subclass of Adder class...
Eigen::RowVector3d RowVector3d
RowVector3d is an alias for a 3-elements row vector of Eigen float numbers.
ShPtr< Element > ElPtr
An alias for a shared pointer of Element class.
virtual void compute_impl(Json &data, JsonToVoidFunc check_required_keys, JsonToBoolFunc check_optional_keys) override
This method overrides Updater::compute_impl.
Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > ArrayXXd
ArrayXXd is an alias for a two-dimensional array of float numbers.
std::function< bool(const Json &)> JsonToBoolFunc
An alias for a function accepts a Json object and returns a bool.
nlohmann::json Json
Json is an alias for nlohmann::json.
ShPtr< Generator > ext_generator
Namespace for utility functions.
std::function< void(const Json &)> JsonToVoidFunc
An alias for a function accepts a Json object.
AddDihedralAngle(const ElPtr &elem)
Constructor of AddDihedralAngle class.
Map< Json, int > map_to_index(const Json &data, const Str &key)
Create a Map object from values of selected property in an array Json object to corresponding index i...