Closed RMeli closed 6 years ago
Look at std::unordered_set
for storage of bonds, angles and dihedrals.
Hash function using std::hash
.
If two elements have the same hash, then the comparison operator is used.
Check if std::unordered_set
can give problems when constraints are added. The constraint matrix must have the same order of Wilson's B matrix.
Added comparison functions to bonds, angles and dihedrals.
Added ordering on indices (stored internally). Order the indices is necessary in order to create an hash function using boost::hash_combine
.
The cost of checking if an element is present in a std::vector
is acceptable for the time being, therefore this issue is solved with the function add_without_duplicates
.
User-defined bond are added to the list of bonds, angles and dihedrals obtained from the connectivity of the molecule and therefore might be redundant.
The same problem will arise with constraints: an added constraint can or can not correspond to a bond, angle or dihedral that is obtained from the connectivity.