Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

fix pos scaling (ang2nm) in lammps data reader #697

Merged
merged 2 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Version 2021.1 (released XX.03.21)
==================================

- format code with clang-12 and drop gmx2020 builds (#691)
- fix pos scaling (ang2nm) in lammps data reader (#697)

Version 2021 (released 13.03.21)
================================
Expand Down
2 changes: 1 addition & 1 deletion src/libcsg/modules/io/lammpsdatareader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ void LAMMPSDataReader::ReadAtoms_(Topology &top) {
}

Eigen::Vector3d xyz_pos(x, y, z);
b->setPos(xyz_pos);
b->setPos(xyz_pos * tools::conv::ang2nm);
}

if (top.BeadCount() != numberOf_["atoms"]) {
Expand Down
8 changes: 4 additions & 4 deletions src/tests/test_lammpsdatareader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ BOOST_AUTO_TEST_CASE(test_topologyreader) {
lammpsDataReader->ReadTopology(lammpsdatafilename, top);

BOOST_CHECK_EQUAL(top.BeadCount(), 100);
Eigen::Vector3d first_bead_correct_pos(62.806, 52.5127, 49.8873);
Eigen::Vector3d first_bead_correct_pos(6.2806, 5.25127, 4.98873);
Bead *firstBead = top.getBead(0);
auto first_bead_pos = firstBead->getPos();
BOOST_CHECK(first_bead_correct_pos.isApprox(first_bead_pos, 1e-3));

Eigen::Vector3d last_bead_correct_pos(102.78495, 78.0388, 59.9629);
Eigen::Vector3d last_bead_correct_pos(10.278495, 7.80388, 5.99629);
Bead *lastBead = top.getBead(99);
auto last_bead_pos = lastBead->getPos();
BOOST_CHECK(last_bead_correct_pos.isApprox(last_bead_pos, 1e-3));
Expand Down Expand Up @@ -120,15 +120,15 @@ BOOST_AUTO_TEST_CASE(test_trajectoryreader) {

BOOST_CHECK_EQUAL(top.BeadCount(), 100);

Eigen::Vector3d first_bead_correct_pos(65.7991, 51.04235, 58.480193);
Eigen::Vector3d first_bead_correct_pos(6.57991, 5.104235, 5.8480193);
Bead *firstBead = top.getBead(0);
auto first_bead_pos = firstBead->getPos();

cout << first_bead_correct_pos << endl;
cout << first_bead_pos << endl;

BOOST_CHECK(first_bead_correct_pos.isApprox(first_bead_pos, 1e-3));
Eigen::Vector3d last_bead_correct_pos(108.431, 83.94695, 68.5254);
Eigen::Vector3d last_bead_correct_pos(10.8431, 8.394695, 6.85254);
Bead *lastBead = top.getBead(99);
auto last_bead_pos = lastBead->getPos();

Expand Down