//////////////////////////////////////////////////////////////////////////////// // // AtomSet.h // //////////////////////////////////////////////////////////////////////////////// // $Id: AtomSet.h,v 1.20 2008-03-21 00:26:19 fgygi Exp $ #ifndef ATOMSET_H #define ATOMSET_H #include "Context.h" #include "Atom.h" #include "UnitCell.h" #include #include #include #include #include class Species; class AtomSet { private: const Context& ctxt_; int nel_; std::map na_; // na_[sp_name]: number of at. of spec. sp_name std::map isp_; // isp_[sp_name]: index of species sp_name std::map is_; // is_[atom_name]: is index of atom atom_name std::map ia_; // ia_[atom_name]: ia index of atom atom_name std::vector spname; // spname[is]: name of species is UnitCell cell_; public: AtomSet(const Context& ctxt) : ctxt_(ctxt), nel_(0) {} std::vector > atom_list; // atom_list[is][ia] std::vector species_list; // species_list[is] const Context& context(void) const { return ctxt_; } bool addAtom(Atom *a); bool delAtom(std::string name); bool addSpecies(Species *sp, std::string name); bool delSpecies(std::string name); bool reset(void); // remove all atoms and species Atom *findAtom(std::string name) const; Species *findSpecies(std::string name) const; void listAtoms(void) const; void listSpecies(void) const; int na(const std::string& spname) const; // number of atoms of species spname int na(int is) const; // number of atoms of species is int isp(const std::string& spname) const; // index of species spname int is(const std::string& atom_name) const; int ia(const std::string& atom_name) const; int nel(void) const { return nel_; }; int nsp(void) const { return species_list.size(); } void get_positions(std::vector >& tau) const; void set_positions(const std::vector >& tau); void get_velocities(std::vector >& vel) const; void set_velocities(const std::vector >& vel); const UnitCell& cell(void) const { return cell_; } void set_cell(const UnitCell& cell) { cell_ = cell; } void set_cell(const D3vector& a, const D3vector& b, const D3vector& c) { cell_.set(a,b,c); } void sync(void); void reset_velocities(void); D3vector vcm(void) const; D3vector dipole(void) const; void reset_vcm(void); void fold_in_ws(void); int size(void) const; }; std::ostream& operator << ( std::ostream &os, const AtomSet &as ); #endif