Commit c7faf18e by Francois Gygi

add quadrupole member to Atomset

git-svn-id: http://qboxcode.org/svn/qb/branches/efield@1573 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 27ae6096
......@@ -15,7 +15,6 @@
// AtomSet.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AtomSet.C,v 1.29 2010-04-16 21:40:50 fgygi Exp $
#include "AtomSet.h"
#include "Species.h"
......@@ -575,6 +574,24 @@ D3vector AtomSet::dipole(void) const
}
////////////////////////////////////////////////////////////////////////////////
D3tensor AtomSet::quadrupole(void) const
{
D3tensor sum;
for ( int is = 0; is < atom_list.size(); is++ )
{
double charge = species_list[is]->zval();
for ( int ia = 0; ia < atom_list[is].size(); ia++ )
{
D3vector p = atom_list[is][ia]->position();
for ( int idir = 0; idir < 3; idir++ )
for ( int jdir = 0; jdir < 3; jdir++ )
sum[idir*3+jdir] += charge * p[idir] * p[jdir];
}
}
return sum;
}
////////////////////////////////////////////////////////////////////////////////
void AtomSet::set_cell(const D3vector& a, const D3vector& b, const D3vector& c)
{
cell_.set(a,b,c);
......
......@@ -15,7 +15,6 @@
// AtomSet.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AtomSet.h,v 1.26 2010-05-10 20:52:54 fgygi Exp $
#ifndef ATOMSET_H
#define ATOMSET_H
......@@ -23,6 +22,7 @@
#include "Context.h"
#include "Atom.h"
#include "UnitCell.h"
#include "D3tensor.h"
#include <vector>
#include <string>
#include <list>
......@@ -87,6 +87,7 @@ class AtomSet
void randomize_positions(double amplitude);
D3vector vcm(void) const;
D3vector dipole(void) const;
D3tensor quadrupole(void) const;
void reset_vcm(void);
void fold_in_ws(void);
int size(void) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment