- Timestamp:
- Oct 5, 2011, 9:18:20 AM (13 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- faca99
- Parents:
- e2e0a5a
- git-author:
- Daniel Dueck <dueck@…> (10/13/10 08:26:41)
- git-committer:
- Frederik Heber <heber@…> (10/05/11 09:18:20)
- Location:
- src
- Files:
-
- 2 added
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Makefile.am
re2e0a5a r807c0e 179 179 Actions/MoleculeAction/ChangeNameAction.cpp \ 180 180 Actions/MoleculeAction/CopyAction.cpp \ 181 Actions/MoleculeAction/CreateMicelleAction.cpp \ 181 182 Actions/MoleculeAction/FillWithMoleculeAction.cpp \ 182 183 Actions/MoleculeAction/FillVoidWithMoleculeAction.cpp \ … … 195 196 Actions/MoleculeAction/ChangeNameAction.hpp \ 196 197 Actions/MoleculeAction/CopyAction.hpp \ 198 Actions/MoleculeAction/CreateMicelleAction.hpp \ 197 199 Actions/MoleculeAction/FillWithMoleculeAction.hpp \ 198 200 Actions/MoleculeAction/FillVoidWithMoleculeAction.hpp \ … … 211 213 Actions/MoleculeAction/ChangeNameAction.def \ 212 214 Actions/MoleculeAction/CopyAction.def \ 215 Actions/MoleculeAction/CreateMicelleAction.def \ 213 216 Actions/MoleculeAction/FillWithMoleculeAction.def \ 214 217 Actions/MoleculeAction/FillVoidWithMoleculeAction.def \ -
src/Actions/MoleculeAction/CreateMicelleAction.cpp
-
Property mode
changed from
100755
to100644
re2e0a5a r807c0e 6 6 */ 7 7 8 /** \file mizelledata.cpp 8 /* 9 * CreateMicelleAction.cpp 9 10 * 10 * Implementation of a micelle creator by Daniel Dueck. 11 * Created on: Sept 29, 2010 12 * Author: dueck 11 13 */ 12 14 … … 17 19 18 20 #include "CodePatterns/MemDebug.hpp" 21 22 #include "CodePatterns/Log.hpp" 23 #include "CodePatterns/Verbose.hpp" 24 25 #include "Actions/ActionHistory.hpp" 26 #include "Actions/ActionRegistry.hpp" 27 #include "Actions/GraphAction/SubgraphDissectionAction.hpp" 28 #include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp" 29 #include "Descriptors/AtomIdDescriptor.hpp" 30 #include "Descriptors/MoleculeDescriptor.hpp" 31 #include "LinearAlgebra/Line.hpp" 32 #include "Parser/PdbParser.hpp" 33 #include "Parser/TremoloParser.hpp" 34 #include "Parser/XyzParser.hpp" 35 #include "Parser/FormatParserStorage.hpp" 36 #include "Shapes/BaseShapes.hpp" 37 #include "Shapes/ShapeOps.hpp" 38 39 40 #include "atom.hpp" 41 #include "Bond/bond.hpp" 42 #include "boundary.hpp" 43 #include "molecule.hpp" 44 #include "World.hpp" 45 46 #include <iostream> 47 #include <string> 48 49 #include "Actions/MoleculeAction/CreateMicelleAction.hpp" 50 51 #include "CreateMicelleAction.def" 52 #include "Action_impl_pre.hpp" 53 54 using namespace std; 55 56 #include "UIElements/UIFactory.hpp" 57 #include "UIElements/Dialog.hpp" 58 #include "Actions/ValueStorage.hpp" 59 60 // memento to remember the state when undoing 19 61 20 62 #include <iostream> … … 24 66 #include "molecule.hpp" 25 67 #include "LinearAlgebra/Vector.hpp" 26 #include "LinearAlgebra/Line.hpp"27 68 #include "World.hpp" 28 #include "Parser/FormatParserStorage.hpp"29 #include "Parser/TremoloParser.hpp"30 #include "Parser/XyzParser.hpp"31 #include "Parser/PdbParser.hpp"32 #include "Parser/FormatParserStorage.hpp"33 69 #include <gsl/gsl_poly.h> 34 70 #include <gsl/gsl_eigen.h> 35 #include "Actions/ActionHistory.hpp"36 #include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"37 #include "Actions/GraphAction/SubgraphDissectionAction.hpp"38 #include "Shapes/BaseShapes.hpp"39 #include "Shapes/ShapeOps.hpp"40 41 71 #define PATH "/home/heber/tmp/" 42 43 72 #define AtomVector std::vector <atom *> 44 73 #define MoleculeVector std::vector <molecule *> … … 47 76 int Delta2(int x1, int x2); 48 77 double Sqlength (Vector x); 49 int main () 50 { 51 setVerbosity(4); 52 // need to init the history before any action is created 53 ActionHistory::init(); 54 55 //1.Molekuel aus pdbfile einlesen und in Variablen speichern 56 57 string path; 58 { 59 std::ifstream file; 60 path = PATH; 61 path += "/tensid.data"; 62 file.open(path.c_str()); 63 FormatParserStorage::getInstance().getTremolo().load(&file); 64 file.close(); 65 } 78 79 /** =========== define the function ====================== */ 80 Action::state_ptr MoleculeCreateMicelleAction::performCall() { 81 82 getParametersfromValueStorage(); 83 66 84 AtomVector ever = World::getInstance().getAllAtoms(); 67 85 68 86 // as all parsed atoms go into same molecule 69 87 // we don't need to create one and add them all to it 70 molecule *stick = ever[0]->getMolecule(); 88 MoleculeVector all = World::getInstance().getSelectedMolecules(); 89 molecule *stick = *(all.begin()); 71 90 72 91 //3.Molekuel zentrieren … … 77 96 Vector den(0.0,0.0,1.0); 78 97 79 World::getInstance().clearMoleculeSelection(); // unselect all80 World::getInstance().selectMolecule(stick); // select the desired molecule for the following action81 98 MoleculeRotateToPrincipalAxisSystem(den); 82 99 /* determine … … 84 101 (0,0,1) 85 102 */ 86 103 string path; 87 104 /**/ 88 105 { … … 103 120 104 121 105 106 122 { 107 123 std::ofstream file; … … 115 131 //6.Molekuel mehrfach strukturiert mit der Haupttraegheitsachse senkrecht zu einer parametrisierten Oberflaeche anordnen 116 132 117 int N=200;118 133 //6.1. Punkte auf der Oberflaeche bestimmen 119 134 //Algorithmus entnommen aus "http://www.cgafaq.info/wiki/Evenly_distributed_points_on_sphere" 120 135 121 136 int ka =0; 122 double radius= 1.5*sqrt(pow(1.55, 2)* N);137 double radius= 1.5*sqrt(pow(1.55, 2)*params.N); 123 138 124 139 Shape s = resize(Sphere(), radius); 125 std::vector<Vector> pt = s.getHomogeneousPointsOnSurface( N);140 std::vector<Vector> pt = s.getHomogeneousPointsOnSurface(params.N); 126 141 127 142 //6.2."stick" um Radius und Molekuelausdehnung in z-Richtung verschieben. … … 146 161 //double MYEPSILON=1e-10; 147 162 148 for (ka = 0; ka< N; ka++){149 cout << "Creating " << ka+1 << " copy of tenside molecule , ";163 for (ka = 0; ka<params.N-1; ka++){ 164 cout << "Creating " << ka+1 << " copy of tenside molecule 'stick' with " << stick->getAtomCount() << " atoms, "; 150 165 molecule *Tensid=stick->CopyMolecule(); 151 166 … … 163 178 Tensid=NULL; 164 179 } 165 166 GraphSubgraphDissection(); 167 168 molecule::iterator it2= stick->begin(); 169 while(it2!=stick->end()) { 170 atom *part=*it2; 171 ++it2; 172 stick->RemoveAtom(part); 173 World::getInstance().destroyAtom (part); 174 }; 175 World::getInstance().destroyMolecule(stick); 176 177 //7. Speichern der Molekuelliste in einem data-file 178 179 { 180 std::ofstream file; 181 path = PATH; 182 path += "/tensidoutput2.pdb"; 183 file.open(path.c_str()); 184 FormatParserStorage::getInstance().getPdb().save(&file, World::getInstance().getAllAtoms()); 185 file.close(); 186 } 187 188 { 189 std::ofstream file; 190 path = PATH; 191 path += "/tensidoutput2.data"; 192 file.open(path.c_str()); 193 FormatParserStorage::getInstance().getTremolo().save(&file, World::getInstance().getAllAtoms()); 194 file.close(); 195 } 196 197 //Anhang 198 199 200 //gsl_matrix_free (Tensor1); 201 //gsl_vector_complex_free (eval); 202 //gsl_matrix_complex_free (evec); 203 //gsl_eigen_nonsymmv_free (w); 204 205 206 MoleculeVector never= World::getInstance().getAllMolecules(); 207 MoleculeVector::iterator it3 = never.begin(); 208 while(it3!=never.end()) { 209 molecule *Tensid=*it3; 210 ++it3; 211 World::getInstance().destroyMolecule(Tensid); 212 }; 213 ever=World::getInstance().getAllAtoms(); 214 AtomVector::iterator it=ever.begin(); 215 while(it!=ever.end()) { 216 atom *member=*it; 217 ++it; 218 World::getInstance().destroyAtom(member); 219 member=NULL; 220 } 221 222 //delete parserx; 223 /*for(int Zaehler=0; Zaehler<3;Zaehler++){ 224 delete[] Tensor[Zaehler]; 225 } 226 delete[] Tensor; 227 for(int Zaehler=0; Zaehler<3;Zaehler++){ 228 delete[] rotationmatrix[Zaehler]; 229 } 230 delete[] rotationmatrix; 231 */ 232 /*for (ka = 0; ka<N; ka++){ 233 delete pt[ka]; 234 } 235 delete[] pt; 236 */ 237 238 return 0; 239 } 240 241 int Delta2 (int x1, int x2) { 242 if (x1==x2) return 1; 243 else return 0; 244 } 245 246 double Sqlength (Vector x){ 247 double ergebnis= x[0]*x[0]+x[1]*x[1]+x[2]*x[2]; 248 return ergebnis; 249 } 250 251 /*double[3] rotate (double[3] in[3], double theta, double phi) { 252 double **rotationmatrix; 253 rotationmatrix=new double *[3]; 254 for(int Zaehler=0; Zaehler<3;Zaehler++){ 255 rotationmatrix[Zaehler]=new double[3]; 256 } 257 rotationmatrix[0][0]=cos(theta)*cos(phi); 258 rotationmatrix[0][1]=-sin(phi); 259 rotationmatrix[0][2]=sin(theta)*cos(phi); 260 rotationmatrix[1][0]=cos(theta)*sin(phi); 261 rotationmatrix[1][1]=cos(phi); 262 rotationmatrix[1][2]=sin(theta)*sin(phi); 263 rotationmatrix[2][0]=-sin(theta); 264 rotationmatrix[2][1]=0; 265 rotationmatrix[2][2]=cos(theta); 266 double zahl[3]; 267 for(int Zaehler=0; Zaehler<3;Zaehler++){ 268 Zahl[Zaehler]=rotationmatrix[Zaehler][0]*in[0]+rotationmatrix[Zaehler][1]*in[1]+rotationmatrix[Zaehler][2]*in[2]; 269 } 270 for(int Zaehler=0; Zaehler<3;Zaehler++){ 271 delete[] rotationmatrix[Zaehler]; 272 } 273 delete[] rotationmatrix; 274 }*/ 180 cout << "shifting " << ka+1 << " copy of tenside molecule, "; 181 molecule *Tensid=stick; 182 183 cout << "rotating ..."; 184 Vector ZAxis(Vector(0.0,0.0,1.0)); 185 Vector Axis(pt[params.N-1]); 186 const double alpha = ZAxis.Angle(Axis); 187 Axis.VectorProduct(ZAxis); 188 Line RotationAxis2(Vector(0.0,0.0,1.0), Axis); // pt is the current Vector of point on surface 189 190 for (molecule::iterator it2=Tensid->begin();it2 !=Tensid->end();++it2) 191 (*it2)->setPosition(RotationAxis.rotateVector((*it2)->getPosition(),alpha)); 192 cout << "done." << endl; 193 194 Tensid=NULL; 195 196 GraphSubgraphDissection(); 197 198 return Action::success; 199 } 200 201 Action::state_ptr MoleculeCreateMicelleAction::performUndo(Action::state_ptr _state) { 202 // MoleculeFillVoidWithMoleculeState *state = assert_cast<MoleculeFillVoidWithMoleculeState*>(_state.get()); 203 204 // string newName = state->mol->getName(); 205 // state->mol->setName(state->lastName); 206 207 return Action::failure; 208 } 209 210 Action::state_ptr MoleculeCreateMicelleAction::performRedo(Action::state_ptr _state){ 211 // Undo and redo have to do the same for this action 212 return performUndo(_state); 213 } 214 215 216 bool MoleculeCreateMicelleAction::canUndo() { 217 return false; 218 } 219 220 221 bool MoleculeCreateMicelleAction::shouldUndo() { 222 return false; 223 } 224 225 /** =========== end of function ====================== */ -
Property mode
changed from
-
src/Makefile.am
re2e0a5a r807c0e 271 271 272 272 noinst_LIBRARIES = libmenu.a 273 bin_PROGRAMS = m izelledata molecuilder molecuildergui joiner analyzer273 bin_PROGRAMS = molecuilder molecuildergui joiner analyzer 274 274 EXTRA_PROGRAMS = unity 275 275 … … 277 277 278 278 libmenu_a_SOURCES = ${UISOURCE} ${UIHEADER} 279 280 # mizelledata stuff281 mizelledata_SOURCES = mizelledata.cpp282 mizelledata_CXXFLAGS = $(BOOST_CPPFLAGS)283 mizelledata_LDFLAGS = $(BOOST_LIB)284 mizelledata_LDADD = \285 libMolecuilderUI.la \286 $(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la \287 ${CodePatterns_LIBS} \288 $(BOOST_LIB)289 279 290 280 molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db
Note:
See TracChangeset
for help on using the changeset viewer.