Changeset f6f761
- Timestamp:
- Oct 2, 2016, 11:51:00 AM (9 years ago)
- Branches:
- Fix_FitPotential_needs_atomicnumbers
- Children:
- 8d5db8
- Parents:
- 5cdfac
- git-author:
- Frederik Heber <heber@…> (10/02/16 11:50:53)
- git-committer:
- Frederik Heber <heber@…> (10/02/16 11:51:00)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/PotentialAction/FitPotentialAction.cpp
r5cdfac rf6f761 69 69 /** =========== define the function ====================== */ 70 70 71 static void registerPotentialIfNotPresent( 72 const std::string &_potentialtype, 73 const SerializablePotential::ParticleTypes_t &_types) 74 { 75 EmpiricalPotential *potential = 76 PotentialFactory::getInstance().createInstance(_potentialtype,_types); 77 // check whether such a potential already exists 78 const std::string potential_name = potential->getName(); 79 if (PotentialRegistry::getInstance().isPresentByName(potential_name)) { 80 delete potential; 81 potential = PotentialRegistry::getInstance().getByName(potential_name); 82 } else 83 PotentialRegistry::getInstance().registerInstance(potential); 84 } 85 86 71 87 ActionState::ptr PotentialFitPotentialAction::performCall() { 72 88 // fragment specifies the homology fragment to use … … 87 103 88 104 // register desired potential and an additional constant one 89 { 90 EmpiricalPotential *potential = 91 PotentialFactory::getInstance().createInstance( 92 params.potentialtype.get(), 93 chargenumbers); 94 // check whether such a potential already exists 95 const std::string potential_name = potential->getName(); 96 if (PotentialRegistry::getInstance().isPresentByName(potential_name)) { 97 delete potential; 98 potential = PotentialRegistry::getInstance().getByName(potential_name); 99 } else 100 PotentialRegistry::getInstance().registerInstance(potential); 101 } 102 { 103 EmpiricalPotential *constant = 104 PotentialFactory::getInstance().createInstance( 105 std::string("constant"), 106 SerializablePotential::ParticleTypes_t()); 107 // check whether such a potential already exists 108 const std::string constant_name = constant->getName(); 109 if (PotentialRegistry::getInstance().isPresentByName(constant_name)) { 110 delete constant; 111 constant = PotentialRegistry::getInstance().getByName(constant_name); 112 } else 113 PotentialRegistry::getInstance().registerInstance(constant); 114 } 105 registerPotentialIfNotPresent(params.potentialtype.get(),chargenumbers); 106 registerPotentialIfNotPresent( 107 std::string("constant"), 108 SerializablePotential::ParticleTypes_t()); 115 109 } 116 110
Note:
See TracChangeset
for help on using the changeset viewer.