<commit_before>// 
// File:   cgengine.cc
// Author: ruehle
//
// Created on April 26, 2007, 4:20 PM
//

#include <fstream>
#include "cgengine.h"
#include <votca/tools/tokenizer.h>

CGEngine::~CGEngine()
{
    map<string, CGMoleculeDef *>::iterator i;
    for(i=_molecule_defs.begin(); i!=_molecule_defs.end();++i)
        delete (*i).second;
    _molecule_defs.clear();
}

/**
    \todo melts with different molecules
*/
TopologyMap *CGEngine::CreateCGTopology(Topology &in, Topology &out)
{
    MoleculeContainer &mols = in.Molecules();
    MoleculeContainer::iterator iter;
    TopologyMap *m = new TopologyMap(&in, &out);
    for(iter=mols.begin(); iter!=mols.end(); ++iter) {
        Molecule *mol = *iter;
        CGMoleculeDef *def = getMoleculeDef(mol->getName());
        if(!def) {
            cout << "unknown molecule " << mol->getName() << " with id "
                 << mol->getId() << " in topology" << endl
                 << "molecule will not be mapped to CG representation" << endl;
            continue;
        }
        Molecule *mcg = def->CreateMolecule(out);
        Map *map = def->CreateMap(*mol, *mcg);
        m->AddMoleculeMap(map);
    }
    out.RebuildExclusions();    
    return m;
}<commit_msg>improved warning for unknown molecule type<commit_after>// 
// File:   cgengine.cc
// Author: ruehle
//
// Created on April 26, 2007, 4:20 PM
//

#include <fstream>
#include "cgengine.h"
#include <votca/tools/tokenizer.h>

CGEngine::~CGEngine()
{
    map<string, CGMoleculeDef *>::iterator i;
    for(i=_molecule_defs.begin(); i!=_molecule_defs.end();++i)
        delete (*i).second;
    _molecule_defs.clear();
}

/**
    \todo melts with different molecules
*/
TopologyMap *CGEngine::CreateCGTopology(Topology &in, Topology &out)
{
    MoleculeContainer &mols = in.Molecules();
    MoleculeContainer::iterator iter;
    TopologyMap *m = new TopologyMap(&in, &out);
    for(iter=mols.begin(); iter!=mols.end(); ++iter) {
        Molecule *mol = *iter;
        CGMoleculeDef *def = getMoleculeDef(mol->getName());
        if(!def) {
            cout << "--------------------------------------\n"
                 << "WARNING: unknown molecule \"" << mol->getName() << "\" with id "
                 << mol->getId() << " in topology" << endl
                 << "molecule will not be mapped to CG representation\n"
                 << "Check weather a mapping file for all molecule exists, was specified in --cg "
                 << "separated by ; and the ident tag in xml-file matches the molecule name\n"
                 << "--------------------------------------\n";
            continue;
        }
        Molecule *mcg = def->CreateMolecule(out);
        Map *map = def->CreateMap(*mol, *mcg);
        m->AddMoleculeMap(map);
    }
    out.RebuildExclusions();    
    return m;
}
{'fraction_non_alphanumeric': 0.17955997161107168, 'fraction_numerical': 0.0063875088715401, 'mean_word_length': 2.3048065650644785, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3588732', 'n_tokens_mistral': 959, 'n_tokens_neox': 898, 'n_words': 210}