Exemplo n.º 1
0
/*!\fn int DistanceTable::add(const ParticleSet& s,const ParticleSet& t, const char* aname) 
 *\param s source particle set
 *\param s target particle set
 *\param aname of a new DistanceTableData
 *\return index of the distance table with the name
 *\brief Adding AsymmetricDTD to the list, e.g., el-nuclei distance table
 */
int
DistanceTable::add(const ParticleSet& s, const ParticleSet& t,  
		   const char* aname) {

  string newname;
  if(aname) {
    newname = aname;
  } else {
    newname = s.getName();
    newname.append(t.getName());
  }

  LOGMSG("Creating a distance table with " << newname)

  map<string,int>::iterator it = TableMap.find(newname);

  ///the named pair does not exist, add a new asymmetric metrics
  if(it == TableMap.end()) {
    int n = TableList.size();
    TableList.push_back(new AsymmetricDTD<NoBConds<double,3> > (s,t));
    TableMap[newname] = n;
    VisitorID.push_back(t.tag());
    return n;
  } else {
    return (*it).second;
  }
}
Exemplo n.º 2
0
ParticleSet::ParticleSet(const ParticleSet& p)
  : UseBoundBox(p.UseBoundBox), UseSphereUpdate(p.UseSphereUpdate),IsGrouped(p.IsGrouped)
  , ThreadID(0), mySpecies(p.getSpeciesSet()),SK(0), ParentTag(p.tag())
{
  initBase();
  initParticleSet();
  assign(p); //obly the base is copied, assumes that other properties are not assignable
  //need explicit copy:
  Mass=p.Mass;
  Z=p.Z;
  ostringstream o;
  o<<p.getName()<<ObjectTag;
  this->setName(o.str());
  app_log() << "  Copying a particle set " << p.getName() << " to " << this->getName() << " groups=" << groups() << endl;
  PropertyList.Names=p.PropertyList.Names;
  PropertyList.Values=p.PropertyList.Values;
  PropertyHistory=p.PropertyHistory;
  Collectables=p.Collectables;
  //construct the distance tables with the same order
  //first is always for this-this paier
  for (int i=1; i<p.DistTables.size(); ++i)
    addTable(p.DistTables[i]->origin());
  if(p.SK)
  {
    R.InUnit=p.R.InUnit;
    createSK();
    SK->DoUpdate=p.SK->DoUpdate;
  }
  if (p.Sphere.size())
    resizeSphere(p.Sphere.size());
  add_p_timer(myTimers);
  myTwist=p.myTwist;
}
Exemplo n.º 3
0
StressPBCAA::StressPBCAA(ParticleSet& ref, bool active) :
  AA(0), myGrid(0), rVs(0), FirstTime(true), myConst(0.0), ForceBase(ref,ref), Ps(ref), is_active(active)
{
  ReportEngine PRE("StressPBCAA","StressPBCAA");
  //save source tag
  SourceID=ref.tag();
  //create a distance table: just to get the table name
  DistanceTableData *d_aa = DistanceTable::add(ref);
  PtclRefName=d_aa->Name;
  initBreakup(ref);
  prefix="S_"+PtclRefName;
  app_log() << "  Maximum K shell " << AA->MaxKshell << endl;
  app_log() << "  Number of k vectors " << AA->Fk.size() << endl;
  if(!is_active)
  {
    d_aa->evaluate(ref);
    update_source(ref);
   app_log()<<"Evaluating Stress SymTensor::Long Range\n"; 
    sLR=evalLR(ref);
   app_log()<<"Short Range...\n";
    sSR=evalSR(ref);
    stress=sLR+sSR+myConst;
    
    //RealType eL(0.0), eS(0.0);
    //if (computeForces)
    //{
    //  forces = 0.0;
    //  eS=evalSRwithForces(ref);
    //  // 1.3978248322
    //  eL=evalLRwithForces(ref);
    //  // 2.130267378
    //}
    //else
    //{
    //  eL=evalLR(ref);
    //  eS=evalSR(ref);
    //}
    //NewValue=Value = eL+eS+myConst;
    //app_log() << "  Fixed Coulomb potential for " << ref.getName();
    //app_log() << "\n    e-e Madelung Const. =" << MC0
    //          << "\n    Vtot     =" << Value << endl;
    
  }
  app_log() << "  Stress SymTensor components for  " << ref.getName();
  app_log() << "\n    e-e Madelung Const. =\n" << MC0
            << "\n    Stot     =\n" << stress 
            << "\n    S_SR     =\n" << sSR   
            << "\n    S_LR     =\n" << sLR
            << "\n    S_Const  =\n" << myConst<<endl;
}
Exemplo n.º 4
0
///** add a distance table to DistTables list
// * @param d_table pointer to a DistanceTableData to be added
// *
// * DistTables is a list of DistanceTables which are updated by MC moves.
// */
//void ParticleSet::addTable(DistanceTableData* d_table) {
//  int oid=d_table->origin().tag();
//  int i=0;
//  int dsize=DistTables.size();
//  while(i<dsize) {
//    if(oid == DistTables[i]->origin().tag()) //table already exists
//      return;
//    ++i;
//  }
//  DistTables.push_back(d_table);
//}
int ParticleSet::addTable(const ParticleSet& psrc)
{
  if (DistTables.empty())
  {
    DistTables.reserve(4);
    DistTables.push_back(createDistanceTable(*this));
    //add  this-this pair
    myDistTableMap.clear();
    myDistTableMap[ObjectTag]=0;
    app_log() << "  ... ParticleSet::addTable Create Table #0 " << DistTables[0]->Name << endl;
    DistTables[0]->ID=0;
    if (psrc.tag() == ObjectTag)
      return 0;
  }
  if (psrc.tag() == ObjectTag)
  {
    app_log() << "  ... ParticleSet::addTable Reuse Table #" << 0 << " " << DistTables[0]->Name <<endl;
    return 0;
  }
  int tsize=DistTables.size(),tid;
  map<int,int>::iterator tit(myDistTableMap.find(psrc.tag()));
  if (tit == myDistTableMap.end())
  {
    tid=DistTables.size();
    DistTables.push_back(createDistanceTable(psrc,*this));
    myDistTableMap[psrc.tag()]=tid;
    DistTables[tid]->ID=tid;
    app_log() << "  ... ParticleSet::addTable Create Table #" << tid << " " << DistTables[tid]->Name <<endl;
  }
  else
  {
    tid = (*tit).second;
    app_log() << "  ... ParticleSet::addTable Reuse Table #" << tid << " " << DistTables[tid]->Name << endl;
  }
  app_log().flush();
  return tid;
}
Exemplo n.º 5
0
void DistanceTable::update(ParticleSet& t) {
  for(int i=0; i< TableList.size(); i++) 
    if(t.tag() == VisitorID[i]) TableList[i]->evaluate(t);
}