diff --git a/src/Action_Vector.cpp b/src/Action_Vector.cpp index 672c0662e1..5c88b1d99a 100644 --- a/src/Action_Vector.cpp +++ b/src/Action_Vector.cpp @@ -105,6 +105,10 @@ Action::RetType Action_Vector::Init(ArgList& actionArgs, ActionInit& init, int d mprinterr("Error: 'ptrajoutput' and 'magnitude' are incompatible.\n"); return Action::ERR; } + if (actionArgs.hasKey("geom")) + useMass_ = false; + else + useMass_ = true; dipole_in_debye_ = actionArgs.hasKey("debye"); needBoxInfo_ = false; // Deprecated: corrired, corr, ired @@ -221,6 +225,10 @@ Action::RetType Action_Vector::Init(ArgList& actionArgs, ActionInit& init, int d mprintf(" %s", filename.c_str()); } mprintf("\n"); + if (useMass_) + mprintf("\tVectors will be mass-weighted if possible.\n"); + else + mprintf("\tVectors will not be mass-weighted.\n"); if (gridSet_ != 0) mprintf("\tExtracting box vectors from grid set '%s'\n", gridSet_->legend()); if (mode_ == DIPOLE || mode_ == BONDDIPOLE) { @@ -493,10 +501,17 @@ void Action_Vector::Dipole(Frame const& currentFrame) { for (AtomMask::const_iterator atom = mask_.begin(); atom != mask_.end(); ++atom) { - double mass = (*CurrentParm_)[*atom].Mass(); - total_mass += mass; - Vec3 XYZ = currentFrame.XYZ( *atom ); - CXYZ += ( XYZ * mass ); + Vec3 XYZ; + if (useMass_) { + double mass = (*CurrentParm_)[*atom].Mass(); + total_mass += mass; + XYZ = currentFrame.XYZ( *atom ); + CXYZ += ( XYZ * mass ); + } else { + total_mass += 1; + XYZ = currentFrame.XYZ( *atom ); + CXYZ += XYZ; + } double charge = (*CurrentParm_)[*atom].Charge(); XYZ *= charge; VXYZ += ( XYZ ); diff --git a/src/Version.h b/src/Version.h index 8a4e4929fa..b58fa75374 100644 --- a/src/Version.h +++ b/src/Version.h @@ -12,7 +12,7 @@ * Whenever a number that precedes is incremented, all subsequent * numbers should be reset to 0. */ -#define CPPTRAJ_INTERNAL_VERSION "V7.9.0" +#define CPPTRAJ_INTERNAL_VERSION "V7.9.1" /// PYTRAJ relies on this #define CPPTRAJ_VERSION_STRING CPPTRAJ_INTERNAL_VERSION #endif diff --git a/test/Test_Vector/RunTest.sh b/test/Test_Vector/RunTest.sh index 4da191b324..18482b8392 100755 --- a/test/Test_Vector/RunTest.sh +++ b/test/Test_Vector/RunTest.sh @@ -3,7 +3,7 @@ . ../MasterTest.sh CleanFiles vector.in vtest.dat.? vtest.dat.?? v8.mol2 corr.v0.v8.dat \ - avgcoord.out res5.out V0.mol2 + avgcoord.out res5.out V0.mol2 dipole.geom.dat center.geom.dat INPUT="-i vector.in" # Test Vector mask, principle xyz, dipole, box @@ -17,7 +17,9 @@ vector v0 principal x @CA out vtest.dat.0 ptrajoutput vector v1 principal y @CA out vtest.dat.1 ptrajoutput vector v2 principal z @CA out vtest.dat.2 ptrajoutput vector v3 @91 @92 out vtest.dat.3 ptrajoutput +vector v3g :1 :12 out center.geom.dat geom vector v4 @91 dipole out vtest.dat.4 ptrajoutput +vector v4g :1 dipole out dipole.geom.dat geom vector v5 box out vtest.dat.5 ptrajoutput vector v6 center out vtest.dat.6 :1 vector v7 corrplane out vtest.dat.7 :2@CD2,CE?,CZ?,CH2 @@ -36,6 +38,8 @@ EOF DoTest vtest.dat.6.save vtest.dat.6 DoTest vtest.dat.7.save vtest.dat.7 DoTest v8.mol2.save v8.mol2 + DoTest dipole.geom.dat.save dipole.geom.dat + DoTest center.geom.dat.save center.geom.dat fi # Test vector center with magnitude diff --git a/test/Test_Vector/center.geom.dat.save b/test/Test_Vector/center.geom.dat.save new file mode 100644 index 0000000000..0a29052624 --- /dev/null +++ b/test/Test_Vector/center.geom.dat.save @@ -0,0 +1,11 @@ +#Frame v3g + 1 6.5354 1.0527 0.3585 0.2786 3.5911 -10.2150 + 2 6.5171 1.2194 0.2099 -0.1118 3.6178 -10.1020 + 3 6.3448 0.8286 0.0968 0.2569 3.6214 -10.0439 + 4 5.9741 1.0754 0.3464 0.4423 4.1335 -10.5752 + 5 6.2152 0.5743 0.3390 0.2946 4.2263 -10.9465 + 6 5.7598 0.6550 -0.0157 0.2756 4.2270 -10.5045 + 7 6.2389 0.3660 -0.1608 0.4048 4.4957 -10.3531 + 8 6.0689 1.0223 0.1760 0.2889 4.3118 -11.1657 + 9 6.4583 0.8418 0.0916 0.6839 4.2325 -10.6609 + 10 6.6421 0.5978 0.4565 0.5445 4.2773 -11.1139 diff --git a/test/Test_Vector/dipole.geom.dat.save b/test/Test_Vector/dipole.geom.dat.save new file mode 100644 index 0000000000..e119c144b8 --- /dev/null +++ b/test/Test_Vector/dipole.geom.dat.save @@ -0,0 +1,11 @@ +#Frame v4g + 1 -0.9060 3.3533 -9.1374 0.2786 3.5911 -10.2150 + 2 -0.8519 3.6188 -8.9540 -0.1118 3.6178 -10.1020 + 3 -0.8640 3.1613 -9.0518 0.2569 3.6214 -10.0439 + 4 -0.5791 4.2167 -9.6783 0.4423 4.1335 -10.5752 + 5 -0.6574 4.3801 -10.0751 0.2946 4.2263 -10.9465 + 6 -0.7908 4.2030 -9.6347 0.2756 4.2270 -10.5045 + 7 -0.3380 4.5732 -9.3458 0.4048 4.4957 -10.3531 + 8 -0.8182 4.0469 -10.0302 0.2889 4.3118 -11.1657 + 9 -0.2335 4.2197 -9.6242 0.6839 4.2325 -10.6609 + 10 -0.3493 4.7089 -10.2172 0.5445 4.2773 -11.1139