32 out <<
"Calculates the mass density distribution along a box axis or "
33 "radial density profile from reference point";
75int main(
int argc,
char **argv) {
77 return app.
Exec(argc, argv);
82 Eigen::Matrix3d box = top->
getBox();
83 Eigen::Vector3d a = box.col(0);
84 Eigen::Vector3d b = box.col(1);
85 Eigen::Vector3d c = box.col(2);
88 axis_ = Eigen::Vector3d::Zero();
91 axis_ = Eigen::Vector3d::UnitX();
93 area_ = b.cross(c).norm();
95 axis_ = Eigen::Vector3d::UnitY();
97 area_ = a.cross(c).norm();
99 axis_ = Eigen::Vector3d::UnitZ();
101 area_ = a.cross(b).norm();
104 rmax_ = min(min((a / 2).norm(), (b / 2).norm()), (c / 2).norm());
106 throw std::runtime_error(
"unknown axis type");
121 ref_ = a / 2 + b / 2 + c / 2;
123 cout <<
"Using referece point: " <<
ref_ << endl;
125 throw std::runtime_error(
126 "reference center can only be used in case of spherical density");
132 cout <<
"rmax: " <<
rmax_ << endl;
134 cout <<
"Bins: " <<
nbin_ << endl;
141 bool did_something =
false;
142 for (
const auto &mol : top->
Molecules()) {
148 const Bead *b = mol.getBead(i);
163 did_something =
true;
167 if (!did_something) {
168 throw std::runtime_error(
"No molecule in selection");
173 string suffix = string(
"_") + boost::lexical_cast<string>(
nblock_);
201 throw std::runtime_error(
"error, invalid character in vector string");
208 std::vector<double> d =
211 throw std::runtime_error(
"error, invalid number of entries in vector");
220 throw std::runtime_error(
221 "did not find closing bracket in string to vec conversion");
239 boost::program_options::value<string>(&
dens_type_)->default_value(
"mass"),
240 "density type: mass or number")(
242 boost::program_options::value<string>(&
axisname_)->default_value(
"r"),
243 "[x|y|z|r] density axis (r=spherical)")(
245 boost::program_options::value<double>(&
step_)->default_value(0.01),
246 "spacing of density")(
"block-length",
247 boost::program_options::value<votca::Index>(),
248 " write blocks of this length, the averages are "
249 "cleared after every write")(
250 "out", boost::program_options::value<string>(&
out_),
"Output file")(
251 "rmax", boost::program_options::value<double>(),
252 "rmax (default for [r] =min of all box vectors/2, else l )")(
254 boost::program_options::value<double>(&
scale_)->default_value(1.0),
255 "scale factor for the density")(
257 boost::program_options::value<string>(&
molname_)->default_value(
"*"),
260 boost::program_options::value<string>(&
filter_)->default_value(
"*"),
261 "filter bead names")(
262 "ref", boost::program_options::value<Eigen::Vector3d>(&
ref_),
263 "reference zero point");
void Initialize() override
Initialize application data.
void EvalConfiguration(Topology *top, Topology *top_ref) override
votca::tools::HistogramNew dist_
void HelpText(ostream &out) override
help text of application without version information
void WriteDensity(votca::Index nframes, const string &suffix="")
bool EvaluateOptions() override
Process command line options.
string ProgramName() override
program name
bool DoTrajectory() override
overload and return true to enable trajectory command line options
void BeginEvaluate(Topology *top, Topology *top_atom) override
called before the first frame
bool DoMappingDefault(void) override
if DoMapping is true, will by default require mapping or not
void EndEvaluate() override
called after the last frame
bool DoMapping() override
overload and return true to enable mapping command line options
votca::Index block_length_
virtual const Eigen::Vector3d & getPos() const
std::string getName() const
Gets the name of the bead.
virtual const double & getMass() const noexcept
bool EvaluateOptions() override
Process command line options.
void Initialize() override
Initialize application data.
topology of the whole system
const Eigen::Matrix3d & getBox() const
Eigen::Vector3d BCShortestConnection(const Eigen::Vector3d &r_i, const Eigen::Vector3d &r_j) const
calculate shortest vector connecting two points
MoleculeContainer & Molecules()
int main(int argc, char **argv)
std::istream & operator>>(std::istream &in, Vector3d &v)