23#include <boost/format.hpp>
36 out <<
"Create skeleton for gromacs topology based on atomistic topology\n"
37 "and a mapping file. File still needs to be modified by the user.";
59 "out", boost::program_options::value<string>(),
60 "output topology (will create .top and in future also .itp)");
65 cout <<
"WARNING: cannot create topology for topology with"
66 "multiple molecules, using only first molecule\n";
69 fl.open((
OptionsMap()[
"out"].as<string>() +
".top"));
77 out <<
"; nr type resnr residue atom cgnr charge mass\n";
80 out << format(
"%d %s 1 RES %s %d %f %f\n") % (i + 1) % b->
getType() %
91 if (ic->getMolecule() != cg.
getId()) {
94 if (nb != ic->BeadCount()) {
98 out <<
"\n[ bonds ]\n";
101 out <<
"\n[ angles ]\n";
104 out <<
"\n[ dihedrals ]\n";
107 string err =
"cannot handle number of beads in interaction:";
108 err += to_string(ic->getMolecule() + 1) +
":" + ic->getGroup();
109 err +=
":" + to_string(ic->getIndex() + 1);
110 throw runtime_error(err);
114 out << ic->getBeadId(i) + 1 <<
" ";
117 out << to_string(ic->getMolecule() + 1);
118 out <<
":" + ic->getGroup();
119 out <<
":" + to_string(ic->getIndex() + 1) << endl;
125 out <<
"[ moleculetype ]\n";
126 out << cg.
getName() <<
" 3\n\n";
132int main(
int argc,
char **argv) {
134 return app.
Exec(argc, argv);
void WriteInteractions(ostream &out, const Topology &top, Molecule &cg)
bool EvaluateOptions(void) override
Process command line options.
string ProgramName() override
program name
void WriteMolecule(ostream &out, const Topology &top, Molecule &cg)
void HelpText(ostream &out) override
help text of application without version information
bool DoMapping(void) override
overload and return true to enable mapping command line options
void Initialize(void) override
Initialize application data.
void WriteAtoms(ostream &out, Molecule &cg)
bool EvaluateTopology(Topology *top, Topology *top_ref) override
called after topology was loaded
virtual const std::string getType() const noexcept
std::string getName() const
Gets the name of the bead.
virtual const double & getMass() const noexcept
virtual const double & getQ() const
bool EvaluateOptions() override
Process command line options.
void Initialize() override
Initialize application data.
base class for all interactions
information about molecules
Bead * getBead(Index bead)
get the id of a bead in the molecule
const std::string & getName() const
get the name of the molecule
Index BeadCount() const
get the number of beads in the molecule
Index getId() const
get the molecule ID
topology of the whole system
Index MoleculeCount() const
number of molecules in the system
Molecule * MoleculeByIndex(Index index)
InteractionContainer & BondedInteractions()
int main(int argc, char **argv)