kylelutz / chemkit

A C++ library for molecular modelling, cheminformatics and molecular visualization.
http://www.chemkit.org
BSD 3-Clause "New" or "Revised" License
54 stars 26 forks source link

possible code errors #40

Open qkligit opened 2 years ago

qkligit commented 2 years ago

Hi,

In file internalcoordinates.cpp, It seems that the 2nd function should be multiplied by DegreesToRadians rather than RadiansToDegress. Also, the bond length r should not be multiplied by RadiansToDegrees, the same is true for ::coordinatesRidians().

// --- Coordinates --------------------------------------------------------- // /// Sets the distance, angle, and torsion at \p row to \p r, /// \p theta and \p phi respectively. The angles are in degrees. void InternalCoordinates::setCoordinates(size_t row, Real r, Real theta, Real phi) { assert(row < d->size);

 d->coordinates[row * 3 + 0] = r;
 d->coordinates[row * 3 + 1] = theta;
 d->coordinates[row * 3 + 2] = phi;

}

/// Sets the distance, angle, and torsion at \p row to \p r, /// \p theta and \p phi respectively. The angles are in radians. void InternalCoordinates::setCoordinatesRadians(size_t row, Real r, Real theta, Real phi) { assert(row < d->size);

 d->coordinates[row * 3 + 0] = r * chemkit::constants::RadiansToDegrees;
 d->coordinates[row * 3 + 1] = theta * chemkit::constants::RadiansToDegrees;
 d->coordinates[row * 3 + 2] = phi * chemkit::constants::RadiansToDegrees;

}