//--- C/C++ includes --- #include //--- Friend includes --- #include "AMoleculeBody.hh" #include "ACommandLineParser.hh" extern "C" #ifdef MSWIN __declspec(dllexport) #endif void function1(AMoleculeBody *bodyList, ACommandLineParser *parser, std::ostream &fout); extern "C" #ifdef MSWIN __declspec(dllexport) #endif void function2(AMoleculeBody *bodyList, ACommandLineParser *parser, std::ostream &fout); // The function calculates number of chains, residues and atoms // for each molecules. At the end it printe number of molecules. // Use command "lib test1 function1" to run it. void function1(AMoleculeBody *bodyList, ACommandLineParser *parser, std::ostream &fout) { int n_mol = 0; // Counter for molecules for (AMoleculeBody *body = bodyList;body;body = body->getNext()) { AMolecule *mol = body->getMolecule(); if (!mol) continue; n_mol++; int n_chains = 0; // Counter for chains int n_groups = 0; // Counter for groups int n_atoms = 0; // Counter for atoms for (AChain *chain = mol->getFirstChain();chain;chain = chain->getNext()) { n_chains++; for (AGroup *group = chain->getFirstGroup();group; group = group->getNext()) { n_groups++; for (AAtom *atom = group->getFirstAtom();atom;atom = atom->getNext()) { n_atoms++; } } } // Printing output to "Friend: command line" window fout<<"Molecule '"<getMolname()<<"':"<getMolname()<<"':"<readBodyNum(); if (parser->errorHappend()) { fout<getErrorMessage()<getErrorMessage()<readChar(); if (parser->errorHappend()) { fout<getErrorMessage()<getErrorMessage()<readBodyNum(); if (parser->errorHappend()) { fout<getErrorMessage()<getErrorMessage()<readChar(); if (parser->errorHappend()) { fout<getErrorMessage()<getErrorMessage()<