コード例 #1
0
ファイル: Multi.hpp プロジェクト: YukiSakamoto/epdp
    void step()
    {
        boost::scoped_ptr<
            typename multi_particle_container_type::transaction_type>
                tx(pc_.create_transaction());
        typedef typename multi_particle_container_type::transaction_type::particle_id_pair_generator particle_id_pair_generator;
        typedef typename multi_particle_container_type::transaction_type::particle_id_pair_and_distance_list particle_id_pair_and_distance_list;
        last_reaction_setter rs(*this);
        volume_clearer vc(*this);
        BDPropagator<traits_type> ppg(
            *tx, *main_.network_rules(), main_.rng(),
            base_type::dt_,
            1 /* FIXME: dissociation_retry_moves */, &rs, &vc,
            make_select_first_range(pc_.get_particles_range()));

        last_event_ = NONE;

        while (ppg())
        {
            if (last_reaction_)
            {
                last_event_ = REACTION;
                break;
            }
        }
    }
コード例 #2
0
ファイル: ParticleSet.BC.cpp プロジェクト: digideskio/qmcpack
  /** Creating StructureFactor
   * 
   * Currently testing only 1 component for PBCs.
   */
  void ParticleSet::createSK() 
  {
   
    if(!sorted_ids && !reordered_ids)
    {
      //save ID and GroupID
      orgID=ID;
      orgGroupID=GroupID;

      if(groups()<1)
      {
        int nspecies=mySpecies.getTotalNum();
        vector<int> ppg(nspecies,0);
        for(int iat=0; iat<GroupID.size(); ++iat) ppg[GroupID[iat]]+=1;
        SubPtcl.resize(nspecies+1);
        SubPtcl[0]=0;
        for(int i=0; i<nspecies; ++i) SubPtcl[i+1]=SubPtcl[i]+ppg[i];
        int new_id=0;
        for(int i=0; i<nspecies; ++i)
          for(int iat=0; iat<GroupID.size(); ++iat) if(GroupID[iat]==i) orgID[new_id++]=ID[iat];
        bool grouped=true;
        for(int iat=0; iat<ID.size(); ++iat) grouped &= (orgID[iat]==ID[iat]);

        if(grouped)
        {
          app_log() << "  ParticleSet is grouped. No need to reorder." << endl;
        }
        else
        {
          app_log() << "  Need to reorder. Only R is swapped." << endl;
          ParticlePos_t oldR(R);
          for(int iat=0; iat<R.size(); ++iat) R[iat]=oldR[orgID[iat]];
          for(int i=0; i<groups(); ++i)
            for(int iat=first(i); iat<last(i); ++iat) GroupID[iat]=i;
          reordered_ids=true;
        }
      }//once group is set, nothing to be done
      sorted_ids=true;
    }

    int membersize= mySpecies.addAttribute("membersize");
    for(int ig=0; ig<mySpecies.size(); ++ig)
      SubPtcl[ig+1]=SubPtcl[ig]+mySpecies(membersize,ig);

    convert2Cart(R); //make sure that R is in Cartesian coordinates
    //if(Lattice.BoxBConds[0] && SK == 0)
    if(Lattice.SuperCellEnum != SUPERCELL_OPEN)
    {
      Lattice.SetLRCutoffs();
      if(SK) 
      {
        app_log() << "\n  Structure Factor is reset by " << Lattice.LR_kc << endl;
        SK->UpdateNewCell(Lattice.LR_kc);
      }
      else
      {
        app_log() << "\n  Creating Structure Factor for periodic systems." <<endl;
        SK = new StructFact(*this,Lattice.LR_kc);
      }
      //Lattice.print(app_log());
      //This uses the copy constructor to avoid recomputing the data.
      //SKOld = new StructFact(*SK);
    }
  }