Ignore:
Timestamp:
Apr 2, 2009, 4:12:54 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
3021d93
Parents:
451d7a
Message:

Basic implementation of Multiple molecules.

builder.cpp:

molecules.hpp:

moleculelist.cpp:

  • replaced listofmolecules array by STL list everywhere (only smaller changes necessary)
  • new merging function: SimpleMerge, SimpleAdd, SimpleMultiMerge, SimpleMultiAdd, (EmbedMerge, ScatterMerge ... both not finished). Add does not while merge does delete the src molecules.
  • new function: Enumerate(). Output of all molecules with number of atoms and chemical formula
  • new function: NumberOfActiveMolecules(). Counts the number of molecules in the list with ActiveFlag set.
  • new function: insert(). Inserts a molecule into the list with a unique index

molecules.cpp:

  • new function: SetNameFromFilename. Takes basename of a filename and sets name accordingly.
  • new function: UnlinkAtom. Only removes atom from list, does not delete it from memory.

atom.cpp:

  • Output() also accepts specific comment instead of "# molecule nr ..."
File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/atom.cpp

    r451d7a rc830e8e  
    11/** \file atom.cpp
    2  * 
     2 *
    33 * Function implementations for the class atom.
    4  * 
     4 *
    55 */
    66
    77#include "molecules.hpp"
    8  
     8
    99/************************************* Functions for class atom *************************************/
    1010
    1111/** Constructor of class atom.
    1212 */
    13 atom::atom() 
     13atom::atom()
    1414{
    1515        Name = NULL;
     
    3333/** Destructor of class atom.
    3434 */
    35 atom::~atom() 
     35atom::~atom()
    3636{
    3737        Free((void **)&Name, "atom::~atom: *Name");
     
    5858 * \param AtomNo cardinal number among these atoms of the same element
    5959 * \param *out stream to output to
     60 * \param *comment commentary after '#' sign
    6061 */
    61 bool atom::Output(int ElementNo, int AtomNo, ofstream *out) const
     62bool atom::Output(int ElementNo, int AtomNo, ofstream *out, const char *comment) const
    6263{
    6364        if (out != NULL) {
     
    6768                if (v.Norm() > MYEPSILON)
    6869                        *out << "\t" << scientific << setprecision(6) << v.x[0] << "\t" << v.x[1] << "\t" << v.x[2] << "\t";
    69                 *out << " # Number in molecule " << nr << endl;
     70                if (comment != NULL)
     71                  *out << " # " << comment << endl;
     72                else
     73                  *out << " # molecule nr " << nr << endl;
    7074                return true;
    7175        } else
     
    8589};
    8690
    87 ostream & operator << (ostream &ost, atom &a) 
     91ostream & operator << (ostream &ost, atom &a)
    8892{
    8993        ost << "[" << a.Name << "|" << &a << "]";
     
    9498 * \param ptr atom to compare index against
    9599 * \return true - this one's is smaller, false - not
    96  */ 
     100 */
    97101bool atom::Compare(atom &ptr)
    98102{
     
    103107};
    104108
    105 bool operator < (atom &a, atom &b) 
     109bool operator < (atom &a, atom &b)
    106110{
    107111        return a.Compare(b);
Note: See TracChangeset for help on using the changeset viewer.