Changeset 9b0dcd for src


Ignore:
Timestamp:
May 19, 2021, 7:06:29 PM (4 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, stable
Children:
20fc6f
Parents:
c98620
git-author:
Frederik Heber <frederik.heber@…> (05/19/21 19:03:24)
git-committer:
Frederik Heber <frederik.heber@…> (05/19/21 19:06:29)
Message:

Added potential-list argument to GeneratePotentialsAction.

  • DOCU: Extended documentation on new option.
  • TEST: Added a test case on this.
Location:
src/Actions/PotentialAction
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/PotentialAction/GeneratePotentialsAction.cpp

    rc98620 r9b0dcd  
    4343#include <string>
    4444
     45#include <boost/foreach.hpp>
     46
    4547#include "Actions/PotentialAction/GeneratePotentialsAction.hpp"
    4648
     
    8082  }
    8183
     84  // gather list of potential candidates
     85  std::vector<std::string> potentials;
     86  if (!params.potential_list.isSet()) {
     87    for (unsigned int i=0; i<PotentialTypesMax; ++i)
     88      potentials.push_back(PotentialFactory::getNameForType((enum PotentialTypes)i));
     89  } else
     90    potentials = params.potential_list.get();
     91
    8292  // go through all potential potentials :)4
    8393  const PotentialFactory& factory = PotentialFactory::getConstInstance();
     
    8696  typedef std::set<BindingModel> unique_models_t;
    8797  unique_models_t unique_models;
    88   for (unsigned int i=0; i<PotentialTypesMax; ++i) {
    89     const std::string potential_name = PotentialFactory::getNameForType((enum PotentialTypes)i);
     98  BOOST_FOREACH(std::string &potential_name, potentials) {
    9099    unique_models.clear();
    91100
     
    102111
    103112    // first need to construct potential, then may access it
    104     EmpiricalPotential const * const defaultPotential = factory.getDefaultPotential((enum PotentialTypes)i);
     113    const enum PotentialTypes potential_type = factory.getTypeForName(potential_name);
     114    EmpiricalPotential const * const defaultPotential = factory.getDefaultPotential(potential_type);
    105115    /// 1. get its number of particles
    106116    const unsigned int num_particles = defaultPotential->getParticleTypeNumber();
  • src/Actions/PotentialAction/GeneratePotentialsAction.def

    rc98620 r9b0dcd  
    99#include "Parameters/Validators/STLVectorValidator.hpp"
    1010#include "Parameters/Validators/Specific/ElementValidator.hpp"
     11#include "Parameters/Validators/Specific/PotentialTypeValidator.hpp"
     12#include <string>
     13#include <vector>
    1114
    1215// i.e. there is an integer with variable name Z that can be found in
    1316// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1417// "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
    15 #define paramtypes (std::vector<const element *>)
    16 #define paramtokens ("fragment-charges")
    17 #define paramdescriptions ("charges specifying the fragment")
    18 #define paramdefaults (NOPARAM_DEFAULT)
    19 #define paramreferences (fragment)
     18#define paramtypes (std::vector<const element *>)(std::vector<std::string>)
     19#define paramtokens ("fragment-charges")("potential-list")
     20#define paramdescriptions ("charges specifying the fragment")("list of potentials to generate or empty for all")
     21#define paramdefaults (NOPARAM_DEFAULT)(NOPARAM_DEFAULT)
     22#define paramreferences (fragment)(potential_list)
    2023#define paramvalids \
    21 (STLVectorValidator< std::vector<const element *> >(0,99, ElementValidator()))
     24(STLVectorValidator< std::vector<const element *> >(0,99, ElementValidator())) \
     25(STLVectorValidator< std::vector<std::string> >(0,99, PotentialTypeValidator()))
    2226
    2327#undef statetypes
Note: See TracChangeset for help on using the changeset viewer.