- Timestamp:
- Aug 18, 2009, 8:48:06 AM (15 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:
- 658efb
- Parents:
- 093645
- git-author:
- Frederik Heber <heber@…> (08/18/09 08:38:46)
- git-committer:
- Frederik Heber <heber@…> (08/18/09 08:48:06)
- Location:
- src
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Makefile.am
r093645 r54a746 1 SOURCE = atom.cpp bond.cpp boundary.cpp builder.cpp config.cpp element.cpp ellipsoid.cpp helpers.cpp linkedcell.cpp moleculelist.cpp molecules.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp2 HEADER = atom.hpp bond.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp helpers.hpp l inkedcell.hpp molecules.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp1 SOURCE = atom.cpp bond.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp moleculelist.cpp molecules.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp 2 HEADER = atom.hpp bond.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp molecules.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp 3 3 4 bin_PROGRAMS = molecuilder joiner analyzer 4 bin_PROGRAMS = molecuilder joiner analyzer VectorUnitTest 5 5 molecuilderdir = ${bindir} 6 6 molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db 7 molecuilder_SOURCES = ${SOURCE} ${HEADER}7 molecuilder_SOURCES = ${SOURCE} builder.cpp ${HEADER} 8 8 joiner_SOURCES = joiner.cpp datacreator.cpp element.cpp helpers.cpp periodentafel.cpp parser.cpp verbose.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp 9 9 analyzer_SOURCES = analyzer.cpp datacreator.cpp element.cpp helpers.cpp periodentafel.cpp parser.cpp verbose.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp 10 10 11 TESTS = VectorUnitTest 12 check_PROGRAMS = $(TESTS) 13 VectorUnitTest_SOURCES = defs.hpp helpers.cpp helpers.hpp leastsquaremin.cpp leastsquaremin.hpp vectorunittest.cpp vectorunittest.hpp vector.cpp vector.hpp verbose.cpp verbose.hpp 14 VectorUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS) 15 VectorUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl 11 16 12 17 EXTRA_DIST = ${molecuilder_DATA} -
src/molecules.cpp
r093645 r54a746 7 7 #include "config.hpp" 8 8 #include "molecules.hpp" 9 10 /************************************* Other Functions *************************************/11 12 /** Determines sum of squared distances of \a X to all \a **vectors.13 * \param *x reference vector14 * \param *params15 * \return sum of square distances16 */17 double LSQ (const gsl_vector * x, void * params)18 {19 double sum = 0.;20 struct LSQ_params *par = (struct LSQ_params *)params;21 Vector **vectors = par->vectors;22 int num = par->num;23 24 for (int i=num;i--;) {25 for(int j=NDIM;j--;)26 sum += (gsl_vector_get(x,j) - (vectors[i])->x[j])*(gsl_vector_get(x,j) - (vectors[i])->x[j]);27 }28 29 return sum;30 };31 9 32 10 /************************************* Functions for class molecule *********************************/ -
src/molecules.hpp
r093645 r54a746 28 28 #include "bond.hpp" 29 29 #include "element.hpp" 30 #include "leastsquaremin.hpp" 30 31 #include "linkedcell.hpp" 31 32 #include "parser.hpp" … … 83 84 84 85 85 // some algebraic matrix stuff86 #define RDET3(a) ((a)[0]*(a)[4]*(a)[8] + (a)[3]*(a)[7]*(a)[2] + (a)[6]*(a)[1]*(a)[5] - (a)[2]*(a)[4]*(a)[6] - (a)[5]*(a)[7]*(a)[0] - (a)[8]*(a)[1]*(a)[3]) //!< hard-coded determinant of a 3x3 matrix87 #define RDET2(a0,a1,a2,a3) ((a0)*(a3)-(a1)*(a2)) //!< hard-coded determinant of a 2x2 matrix88 89 90 /** Parameter structure for least square minimsation.91 */92 struct LSQ_params {93 Vector **vectors;94 int num;95 };96 97 double LSQ(const gsl_vector * x, void * params);98 99 /** Parameter structure for least square minimsation.100 */101 struct lsq_params {102 gsl_vector *x;103 const molecule *mol;104 element *type;105 };106 86 107 87 #define MaxThermostats 6 //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented -
src/tesselation.cpp
r093645 r54a746 2938 2938 double getAngle(const Vector &point, const Vector &reference, const Vector OrthogonalVector) 2939 2939 { 2940 if (reference.Is Null())2940 if (reference.IsZero()) 2941 2941 return M_PI; 2942 2942 2943 2943 // calculate both angles and correct with in-plane vector 2944 if (point.Is Null())2944 if (point.IsZero()) 2945 2945 return M_PI; 2946 2946 double phi = point.Angle(&reference); -
src/vector.cpp
r093645 r54a746 6 6 7 7 8 #include "molecules.hpp" 9 8 #include "defs.hpp" 9 #include "helpers.hpp" 10 #include "leastsquaremin.hpp" 11 #include "vector.hpp" 12 #include "verbose.hpp" 10 13 11 14 /************************************ Functions for class vector ************************************/ … … 247 250 248 251 /** Calculates the intersection of the two lines that are both on the same plane. 249 * Note that we do not check whether they are on the same plane. 252 * Note that we do not check whether they are on the same plane. Vector is calculated with respecy to second line. 250 253 * \param *out output stream for debugging 251 254 * \param *Line1a first vector of first line … … 276 279 *out << Verbose(3) << "INFO: Normal of plane is " << *Normal << "." << endl; 277 280 278 // create normal vector to one line279 Line.CopyVector(Line1b);280 Line.SubtractVector(Line1a);281 LineNormal.MakeNormalVector(&Line, Normal);282 *out << Verbose(3) << "INFO: Normal of first line is " << LineNormal << "." << endl;283 284 281 // check if lines are parallel 285 282 helper.CopyVector(Line2b); 286 283 helper.SubtractVector(Line2a); 287 if (fabs(helper.ScalarProduct( &LineNormal)) < MYEPSILON) {284 if (fabs(helper.ScalarProduct(Normal)) < MYEPSILON) { 288 285 *out << Verbose(1) << "Lines " << helper << " and " << Line << " are parallel, no cross point!" << endl; 289 286 result = false; … … 291 288 helper.CopyVector(Line2a); 292 289 helper.SubtractVector(Line1a); 293 factor1 = helper.ScalarProduct( &LineNormal);290 factor1 = helper.ScalarProduct(Normal); 294 291 helper.CopyVector(Line2b); 295 292 helper.SubtractVector(Line1a); 296 factor2 = helper.ScalarProduct( &LineNormal);293 factor2 = helper.ScalarProduct(Normal); 297 294 if (fabs(factor2) > MYEPSILON) { 298 295 CopyVector(Line2a); … … 380 377 * @return true - vector is zero, false - vector is not 381 378 */ 382 bool Vector::IsNull() const 383 { 384 return (fabs(x[0]+x[1]+x[2]) < MYEPSILON); 379 bool Vector::IsZero() const 380 { 381 return (fabs(x[0])+fabs(x[1])+fabs(x[2]) < MYEPSILON); 382 }; 383 384 /** Checks whether vector has length of 1. 385 * @return true - vector is normalized, false - vector is not 386 */ 387 bool Vector::IsOne() const 388 { 389 return (fabs(Norm() - 1.) < MYEPSILON); 385 390 }; 386 391 … … 437 442 return a; 438 443 }; 444 445 /** Subtracts vector \a from this lhs component-wise. 446 * \param a base vector 447 * \param b vector components to add 448 * \return lhs - a 449 */ 450 Vector& operator-=(Vector& a, const Vector& b) 451 { 452 a.SubtractVector(&b); 453 return a; 454 }; 455 439 456 /** factor each component of \a a times a double \a m. 440 457 * \param a base vector … … 461 478 }; 462 479 480 /** Subtracts vector \a from \b component-wise. 481 * \param a first vector 482 * \param b second vector 483 * \return a - b 484 */ 485 Vector& operator-(const Vector& a, const Vector& b) 486 { 487 Vector *x = new Vector; 488 x->CopyVector(&a); 489 x->SubtractVector(&b); 490 return *x; 491 }; 492 463 493 /** Factors given vector \a a times \a m. 464 494 * \param a vector 465 495 * \param m factor 466 * \return a + b496 * \return m * a 467 497 */ 468 498 Vector& operator*(const Vector& a, const double m) 499 { 500 Vector *x = new Vector; 501 x->CopyVector(&a); 502 x->Scale(m); 503 return *x; 504 }; 505 506 /** Factors given vector \a a times \a m. 507 * \param m factor 508 * \param a vector 509 * \return m * a 510 */ 511 Vector& operator*(const double m, const Vector& a ) 469 512 { 470 513 Vector *x = new Vector; -
src/vector.hpp
r093645 r54a746 5 5 6 6 #include "helpers.hpp" 7 8 #include <gsl/gsl_vector.h> 9 #include <gsl/gsl_multimin.h> 7 10 8 11 class Vector; … … 28 31 double NormSquared() const; 29 32 double Angle(const Vector *y) const; 30 bool IsNull() const; 33 bool IsZero() const; 34 bool IsOne() const; 31 35 32 36 void AddVector(const Vector *y); … … 64 68 65 69 ostream & operator << (ostream& ost, const Vector &m); 66 //Vector& operator+=(Vector& a, const Vector& b); 67 //Vector& operator*=(Vector& a, const double m); 68 //Vector& operator*(const Vector& a, const double m); 69 //Vector& operator+(const Vector& a, const Vector& b); 70 Vector& operator+=(Vector& a, const Vector& b); 71 Vector& operator-=(Vector& a, const Vector& b); 72 Vector& operator*=(Vector& a, const double m); 73 Vector& operator*(const Vector& a, const double m); 74 Vector& operator*(const double m, const Vector& a); 75 Vector& operator+(const Vector& a, const Vector& b); 76 Vector& operator-(const Vector& a, const Vector& b); 77 78 // some algebraic matrix stuff 79 #define RDET3(a) ((a)[0]*(a)[4]*(a)[8] + (a)[3]*(a)[7]*(a)[2] + (a)[6]*(a)[1]*(a)[5] - (a)[2]*(a)[4]*(a)[6] - (a)[5]*(a)[7]*(a)[0] - (a)[8]*(a)[1]*(a)[3]) //!< hard-coded determinant of a 3x3 matrix 80 #define RDET2(a0,a1,a2,a3) ((a0)*(a3)-(a1)*(a2)) //!< hard-coded determinant of a 2x2 matrix 81 82 70 83 71 84 #endif /*VECTOR_HPP_*/
Note:
See TracChangeset
for help on using the changeset viewer.