Commit 9cf1a9d1 by Francois Gygi

Added fold_in_ws member


git-svn-id: http://qboxcode.org/svn/qb/trunk@580 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 275e8c36
......@@ -3,7 +3,7 @@
// AtomSet.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AtomSet.C,v 1.21 2008-03-05 04:04:48 fgygi Exp $
// $Id: AtomSet.C,v 1.22 2008-03-21 00:25:46 fgygi Exp $
#include "AtomSet.h"
#include "Species.h"
......@@ -387,6 +387,25 @@ void AtomSet::reset_vcm(void)
}
////////////////////////////////////////////////////////////////////////////////
void AtomSet::fold_in_ws(void)
{
vector<vector<double> > p;
get_positions(p);
for ( int is = 0; is < p.size(); is++ )
{
for ( int ia = 0; ia < atom_list[is].size(); ia++ )
{
D3vector pos(&p[is][3*ia]);
cell_.fold_in_ws(pos);
p[is][3*ia+0] = pos.x;
p[is][3*ia+1] = pos.y;
p[is][3*ia+2] = pos.z;
}
}
set_positions(p);
}
////////////////////////////////////////////////////////////////////////////////
D3vector AtomSet::dipole(void) const
{
D3vector sum;
......@@ -406,7 +425,8 @@ D3vector AtomSet::dipole(void) const
void AtomSet::sync()
{
#if USE_MPI
// enforce consistency of positions on all tasks
// enforce consistency of positions and velocities on all tasks
// broadcast positions and velocities of task 0 to all tasks
vector<vector<double> > r,v;
get_positions(r);
get_velocities(v);
......
......@@ -3,7 +3,7 @@
// AtomSet.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AtomSet.h,v 1.19 2008-03-05 04:04:48 fgygi Exp $
// $Id: AtomSet.h,v 1.20 2008-03-21 00:26:19 fgygi Exp $
#ifndef ATOMSET_H
#define ATOMSET_H
......@@ -73,6 +73,7 @@ class AtomSet
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 );
......
////////////////////////////////////////////////////////////////////////////////
//
// FoldInWsCmd.h:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: FoldInWsCmd.h,v 1.1 2008-03-21 00:26:19 fgygi Exp $
#ifndef FOLDINWSCMD_H
#define FOLDINWSCMD_H
#include <string>
#include <cstdlib>
#include <iostream>
using namespace std;
#include "UserInterface.h"
#include "Sample.h"
class FoldInWsCmd : public Cmd
{
public:
Sample *s;
FoldInWsCmd(Sample *sample) : s(sample) {};
char *name(void) const { return "fold_in_ws"; }
char *help_msg(void) const
{
return
"\n fold_in_ws\n\n"
" syntax: fold_in_ws \n\n"
" The fold_in_ws command folds all atomic positions back in\n"
" the Wigner-Seitz cell of the current unit cell.\n\n";
}
int action(int argc, char **argv)
{
s->atoms.fold_in_ws();
return 0;
}
};
#endif
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