<commit_before>/* 
 * File:   jcalc.h
 * Author: james
 *
 * Created on 07 December 2009, 17:19
 */

#ifndef _JCALC_H
#define	_JCALC_H

#include <boost/lexical_cast.hpp>
#include <libxml/parser.h>
#include <map>
#include <stdexcept>

#include "crgunittype.h"
#include "votca/tools/tokenizer.h"
#include "crgunit.h"
#include "fock.h"
#include <votca/tools/property.h>

using namespace boost;

class JCalc{

public:

    JCalc() {};
    ~JCalc();
    
    JCalc(string name);

    CrgUnitType * GetCrgUnitTypeByName(string);

    void Initialize(const string &file);
    vector <double> CalcJ (CrgUnit & one, CrgUnit & two);
    int WriteProJ(CrgUnit & one, CrgUnit & two, string namedir=(string("./")) );

    CrgUnit *CreateCrgUnit(int id, const string &type_name, int molid=-1);


    // TODO: EstaticDifference should not be in moo since it might depend on algorithm
    double EstaticDifference(CrgUnit & one, CrgUnit & two);
    
private:

    struct JCalcData{
            /// the CrgUnitType of the first (will contain coordinates of the still molecules
        CrgUnitType *_type1;
        CrgUnitType *_type2;

        ///variables copied from _type1 and _type2
        pair <vector <unsigned int>, vector <unsigned int> > _orblabels;

        /// the moved coordinates
        mol_and_orb _mol1;
        mol_and_orb _mol2;
        /// the moved orbitals
        orb         _orb1;
        orb         _orb2;
        /// the fock matrix herself
        fock        _fock;

    };
    
    /// To parse the xml file
    Property _options;

    /// a list of charge transport units
    vector <CrgUnitType *> _listCrgUnitType;
    /// a map of charge unit type names to their index in the list
    map <string, CrgUnitType *> _mapCrgUnitByName;
    /// map the fock calculators to the pair of integers representing the corresponding charge unit types
    map <pair<CrgUnitType *, CrgUnitType *> , JCalcData *> _maplistfock;

    /// Enter data for Crg Unit Type
    void ParseCrgUnitType(xmlDocPtr doc, xmlNodePtr cur );
    /// Enter data for Crg Unit Types
    void ParseCrgUnitTypes(Property &options);
    /// initialise a JCAlcDAta type
    JCalcData * InitJCalcData(CrgUnitType *, CrgUnitType * );
    /// get a J calc data from the map
    JCalcData * getJCalcData(CrgUnit &, CrgUnit &);
};

inline JCalc::JCalc(string name)
{
        Initialize (name);
}

inline CrgUnit *JCalc::CreateCrgUnit(int id, const string &type_name, int molid)
{
    CrgUnitType *type = GetCrgUnitTypeByName(type_name);
    if(!type)
        throw runtime_error("Charge unit type not found: " + type_name);

    return new CrgUnit(id, type, molid);
}

#endif	/* _JCALC_H */

<commit_msg>kicked out xml stuff<commit_after>/* 
 * File:   jcalc.h
 * Author: james
 *
 * Created on 07 December 2009, 17:19
 */

#ifndef _JCALC_H
#define	_JCALC_H

#include <boost/lexical_cast.hpp>
#include <map>
#include <stdexcept>

#include "crgunittype.h"
#include "votca/tools/tokenizer.h"
#include "crgunit.h"
#include "fock.h"
#include <votca/tools/property.h>

using namespace boost;

class JCalc{

public:

    JCalc() {};
    ~JCalc();
    
    JCalc(string name);

    CrgUnitType * GetCrgUnitTypeByName(string);

    void Initialize(const string &file);
    vector <double> CalcJ (CrgUnit & one, CrgUnit & two);
    int WriteProJ(CrgUnit & one, CrgUnit & two, string namedir=(string("./")) );

    CrgUnit *CreateCrgUnit(int id, const string &type_name, int molid=-1);


    // TODO: EstaticDifference should not be in moo since it might depend on algorithm
    double EstaticDifference(CrgUnit & one, CrgUnit & two);
    
private:

    struct JCalcData{
            /// the CrgUnitType of the first (will contain coordinates of the still molecules
        CrgUnitType *_type1;
        CrgUnitType *_type2;

        ///variables copied from _type1 and _type2
        pair <vector <unsigned int>, vector <unsigned int> > _orblabels;

        /// the moved coordinates
        mol_and_orb _mol1;
        mol_and_orb _mol2;
        /// the moved orbitals
        orb         _orb1;
        orb         _orb2;
        /// the fock matrix herself
        fock        _fock;

    };
    
    /// To parse the xml file
    Property _options;

    /// a list of charge transport units
    vector <CrgUnitType *> _listCrgUnitType;
    /// a map of charge unit type names to their index in the list
    map <string, CrgUnitType *> _mapCrgUnitByName;
    /// map the fock calculators to the pair of integers representing the corresponding charge unit types
    map <pair<CrgUnitType *, CrgUnitType *> , JCalcData *> _maplistfock;

    /// Enter data for Crg Unit Types
    void ParseCrgUnitTypes(Property &options);
    /// initialise a JCAlcDAta type
    JCalcData * InitJCalcData(CrgUnitType *, CrgUnitType * );
    /// get a J calc data from the map
    JCalcData * getJCalcData(CrgUnit &, CrgUnit &);
};

inline JCalc::JCalc(string name)
{
        Initialize (name);
}

inline CrgUnit *JCalc::CreateCrgUnit(int id, const string &type_name, int molid)
{
    CrgUnitType *type = GetCrgUnitTypeByName(type_name);
    if(!type)
        throw runtime_error("Charge unit type not found: " + type_name);

    return new CrgUnit(id, type, molid);
}

#endif	/* _JCALC_H */


{'fraction_non_alphanumeric': 0.10156548300878197, 'fraction_numerical': 0.007254677357770141, 'mean_word_length': 2.824087591240876, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '4284296', 'n_tokens_mistral': 1797, 'n_tokens_neox': 1743, 'n_words': 520}