Changeset 9b0dcd
- Timestamp:
- May 19, 2021, 7:06:29 PM (4 years ago)
- 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)
- Files:
-
- 1 added
- 5 edited
-
doc/userguide/userguide.xml (modified) (2 diffs)
-
src/Actions/PotentialAction/GeneratePotentialsAction.cpp (modified) (4 diffs)
-
src/Actions/PotentialAction/GeneratePotentialsAction.def (modified) (1 diff)
-
tests/Python/AllActions/options.dat (modified) (1 diff)
-
tests/regression/Potential/GeneratePotentials/post/water_restricted.potentials (added)
-
tests/regression/Potential/GeneratePotentials/testsuite-potential-generate-potentials.at (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
doc/userguide/userguide.xml
rc98620 r9b0dcd 2470 2470 particle types the following action can be called: 2471 2471 <programlisting> 2472 ... --generate-potentials 2472 ... --generate-potentials \ 2473 2473 --fragment-charges 8 1 1 2474 2474 </programlisting> … … 2478 2478 subgraphs do not exists for the molecule H-O-H), and tersoff for the 2479 2479 types O and H. 2480 </para> 2480 <programlisting> 2481 ... --generate-potentials \ 2482 --fragment-charges 8 1 1 \ 2483 --potential-list constant harmonic_bond harmonic_angle 2484 </programlisting> 2485 This would generate the potentials taken from the restricted set of 2486 listed potential names. If the give list is empty (i.e. the parameter 2487 is unset), then by default all available potentials are used.</para> 2481 2488 </section> 2482 2489 <section xml:id="potentials.save-potential"> -
src/Actions/PotentialAction/GeneratePotentialsAction.cpp
rc98620 r9b0dcd 43 43 #include <string> 44 44 45 #include <boost/foreach.hpp> 46 45 47 #include "Actions/PotentialAction/GeneratePotentialsAction.hpp" 46 48 … … 80 82 } 81 83 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 82 92 // go through all potential potentials :)4 83 93 const PotentialFactory& factory = PotentialFactory::getConstInstance(); … … 86 96 typedef std::set<BindingModel> unique_models_t; 87 97 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) { 90 99 unique_models.clear(); 91 100 … … 102 111 103 112 // 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); 105 115 /// 1. get its number of particles 106 116 const unsigned int num_particles = defaultPotential->getParticleTypeNumber(); -
src/Actions/PotentialAction/GeneratePotentialsAction.def
rc98620 r9b0dcd 9 9 #include "Parameters/Validators/STLVectorValidator.hpp" 10 10 #include "Parameters/Validators/Specific/ElementValidator.hpp" 11 #include "Parameters/Validators/Specific/PotentialTypeValidator.hpp" 12 #include <string> 13 #include <vector> 11 14 12 15 // i.e. there is an integer with variable name Z that can be found in 13 16 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 14 17 // "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) 20 23 #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())) 22 26 23 27 #undef statetypes -
tests/Python/AllActions/options.dat
rc98620 r9b0dcd 161 161 potential_charges "1 1" 162 162 potential_type "morse" 163 potential_list "angle harmonic_bond" 163 164 radius "20." 164 165 random_atom_displacement "0." -
tests/regression/Potential/GeneratePotentials/testsuite-potential-generate-potentials.at
rc98620 r9b0dcd 32 32 33 33 AT_CLEANUP 34 35 AT_SETUP([Potential - generate potentials for water, restricted set]) 36 AT_KEYWORDS([potential parse-homologies generate-potentials water]) 37 38 file=water_homologies.dat 39 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Potential/GeneratePotentials/pre/$file $file], 0) 40 AT_CHECK([chmod u+w $file], 0, [ignore], [ignore]) 41 AT_CHECK([../../molecuilder \ 42 --parse-homologies $file \ 43 --generate-potentials \ 44 --fragment-charges 1 8 1 \ 45 --potential-list constant harmonic_bond harmonic_angle \ 46 --save-potentials water.potentials], 0, [stdout], [ignore]) 47 AT_CHECK([diff water.potentials ${abs_top_srcdir}/tests/regression/Potential/GeneratePotentials/post/water_restricted.potentials], 0, [ignore], [ignore]) 48 49 AT_CLEANUP
Note:
See TracChangeset
for help on using the changeset viewer.
