Changeset 03a589
- Timestamp:
- Apr 4, 2012, 11:30:11 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:
- 47ed3d
- Parents:
- ce7bfd
- git-author:
- Frederik Heber <heber@…> (03/26/12 07:44:19)
- git-committer:
- Frederik Heber <heber@…> (04/04/12 11:30:11)
- Location:
- src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Analysis/unittests/CountBondsUnitTest.cpp
rce7bfd r03a589 129 129 }; 130 130 131 void OutputTestMolecule1(molecule *mol, const char *name)132 {133 ofstream output(name);134 mol->OutputXYZ(&output);135 output.close();136 }137 138 131 /** UnitTest for CountBondsTest::HydrogenBridgeBondsTest(). 139 132 */ … … 146 139 Vector Translator; 147 140 148 //OutputTestMolecule1(TestMolecule1, "testmolecule1.xyz");149 150 141 // create TestMolecule2 as copy 151 142 TestMolecule2 = TestMolecule1->CopyMolecule(); … … 158 149 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 159 150 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, oxygen, NULL) ); 160 //OutputTestMolecule1(TestMolecule1, "testmolecule2-1.xyz");161 151 Translator = Vector(-3,0,0); 162 152 TestMolecule1->Translate(&Translator); … … 166 156 TestMolecule1->Translate(&Translator); 167 157 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 168 //OutputTestMolecule1(TestMolecule1, "testmolecule2-2.xyz");169 158 Translator = Vector(0,-3,0); 170 159 TestMolecule1->Translate(&Translator); … … 175 164 TestMolecule1->Translate(&Translator); 176 165 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 177 //OutputTestMolecule1(TestMolecule1, "testmolecule2-3.xyz");178 166 Translator = Vector(0,3,0); 179 167 TestMolecule1->Translate(&Translator); … … 184 172 TestMolecule1->Translate(&Translator); 185 173 CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 186 //OutputTestMolecule1(TestMolecule1, "testmolecule2-4.xyz");187 174 Translator = Vector(-2,-1,0); 188 175 TestMolecule1->Translate(&Translator); … … 192 179 TestMolecule1->Translate(&Translator); 193 180 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 194 //OutputTestMolecule1(TestMolecule1, "testmolecule2-5.xyz");195 181 Translator = Vector(0,0,-3); 196 182 TestMolecule1->Translate(&Translator); … … 201 187 TestMolecule1->Translate(&Translator); 202 188 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 203 //OutputTestMolecule1(TestMolecule1, "testmolecule2-6.xyz");204 189 Translator = Vector(3,0,0); 205 190 TestMolecule1->Translate(&Translator); … … 211 196 TestMolecule1->Translate(&Translator); 212 197 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 213 //OutputTestMolecule1(TestMolecule1, "testmolecule2-7.xyz");214 198 Translator = Vector(-3,0,0); 215 199 TestMolecule1->Translate(&Translator); … … 220 204 TestMolecule1->Scale((const double ** const)&mirror); 221 205 TestMolecule1->Translate(&Translator); 222 //OutputTestMolecule1(TestMolecule1, "testmolecule2-8.xyz");223 206 CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) ); 224 207 Translator = Vector(0,-3,0); -
src/Atom/atom.cpp
rce7bfd r03a589 159 159 }; 160 160 161 bool atom::OutputXYZLine(ofstream *out) const162 {163 if (out != NULL) {164 *out << getType()->getSymbol() << "\t" << at(0) << "\t" << at(1) << "\t" << at(2) << "\t" << endl;165 return true;166 } else167 return false;168 };169 170 bool atom::OutputTrajectory(ofstream * const out, const enumeration<const element*> &elementLookup, int *AtomNo, const int step) const171 {172 AtomNo[getType()->getAtomicNumber()]++;173 if (out != NULL) {174 const element *elemental = getType();175 ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");176 *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[getType()->getAtomicNumber()] << "\t" << fixed << setprecision(9) << showpoint;177 *out << getPositionAtStep(step)[0] << "\t" << getPositionAtStep(step)[1] << "\t" << getPositionAtStep(step)[2];178 *out << "\t" << (int)(getFixedIon());179 if (getAtomicVelocityAtStep(step).Norm() > MYEPSILON)180 *out << "\t" << scientific << setprecision(6) << getAtomicVelocityAtStep(step)[0] << "\t" << getAtomicVelocityAtStep(step)[1] << "\t" << getAtomicVelocityAtStep(step)[2] << "\t";181 if (getAtomicForceAtStep(step).Norm() > MYEPSILON)182 *out << "\t" << scientific << setprecision(6) << getAtomicForceAtStep(step)[0] << "\t" << getAtomicForceAtStep(step)[1] << "\t" << getAtomicForceAtStep(step)[2] << "\t";183 *out << "\t# Number in molecule " << getNr() << endl;184 return true;185 } else186 return false;187 };188 189 bool atom::OutputTrajectoryXYZ(ofstream * const out, const int step) const190 {191 if (out != NULL) {192 *out << getType()->getSymbol() << "\t";193 *out << getPositionAtStep(step)[0] << "\t";194 *out << getPositionAtStep(step)[1] << "\t";195 *out << getPositionAtStep(step)[2] << endl;196 return true;197 } else198 return false;199 };200 201 void atom::OutputMPQCLine(ostream * const out, const Vector *center) const202 {203 Vector recentered(getPosition());204 recentered -= *center;205 *out << "\t\t" << getType()->getSymbol() << " [ " << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " ]" << endl;206 };207 208 void atom::OutputPsi3Line(ostream * const out, const Vector *center) const209 {210 Vector recentered(getPosition());211 recentered -= *center;212 *out << "\t( " << getType()->getSymbol() << "\t" << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " )" << endl;213 };214 215 161 bool atom::Compare(const atom &ptr) const 216 162 { -
src/Atom/atom.hpp
rce7bfd r03a589 84 84 */ 85 85 bool OutputArrayIndexed(ostream * const out,const enumeration<const element*>&, int *AtomNo, const char *comment = NULL) const; 86 87 /** Output of a single atom as one line in xyz file.88 * \param *out stream to output to89 * \return true - \a *out present, false - \a *out is NULL90 */91 bool OutputXYZLine(ofstream *out) const;92 93 /** Output of a single atom as one line in xyz file.94 * \param *out stream to output to95 * \param *ElementNo array with ion type number in the config file this atom's element shall have96 * \param *AtomNo array with atom number in the config file this atom shall have, is increase by one automatically97 * \param step Trajectory time step to output98 * \return true - \a *out present, false - \a *out is NULL99 */100 bool OutputTrajectory(ofstream * const out, const enumeration<const element*>&, int *AtomNo, const int step) const;101 102 /** Output of a single atom as one lin in xyz file.103 * \param *out stream to output to104 * \param step Trajectory time step to output105 * \return true - \a *out present, false - \a *out is NULL106 */107 bool OutputTrajectoryXYZ(ofstream * const out, const int step) const;108 109 /** Outputs the MPQC configuration line for this atom.110 * \param *out output stream111 * \param *center center of molecule subtracted from position112 * \param *AtomNo pointer to atom counter that is increased by one113 */114 void OutputMPQCLine(ostream * const out, const Vector *center) const;115 116 /** Outputs the Psi3 configuration line for this atom.117 * \param *out output stream118 * \param *center center of molecule subtracted from position119 * \param *AtomNo pointer to atom counter that is increased by one120 */121 void OutputPsi3Line(ostream * const out, const Vector *center) const;122 86 123 87 /** Initialises the component number array. -
src/Parser/MpqcParser.cpp
rce7bfd r03a589 19 19 20 20 #include <iostream> 21 #include <boost/foreach.hpp> 21 22 #include <boost/tokenizer.hpp> 22 23 #include <string> … … 216 217 } 217 218 219 void FormatParser< mpqc >::OutputMPQCLine(ostream * const out, const atom &_atom, const Vector *center) const 220 { 221 Vector recentered(_atom.getPosition()); 222 recentered -= *center; 223 *out << "\t\t" << _atom.getType()->getSymbol() << " [ " << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " ]" << std::endl; 224 }; 225 226 218 227 /** Saves all atoms and data into a MPQC config file. 219 228 * \param *file output stream … … 306 315 *file << "\t{ atoms geometry } = {" << endl; 307 316 // output of atoms 308 for (std::vector<atom *>::const_iterator AtomRunner = atoms.begin(); AtomRunner != atoms.end(); ++AtomRunner) {309 (*AtomRunner)->OutputMPQCLine(file, ¢er);317 BOOST_FOREACH(const atom *_atom, atoms) { 318 OutputMPQCLine(file, *_atom, ¢er); 310 319 } 311 320 *file << "\t}" << endl; -
src/Parser/MpqcParser.hpp
rce7bfd r03a589 25 25 26 26 #include <iosfwd> 27 28 class Vector; 27 29 28 30 // declaration of specialized FormatParserTrait … … 59 61 60 62 private: 63 void OutputMPQCLine(ostream * const out, const atom &_atom, const Vector *center) const; 64 61 65 static ConvertTo<bool> Converter; 62 66 }; -
src/Parser/Psi3Parser.cpp
rce7bfd r03a589 19 19 20 20 #include <iostream> 21 #include <boost/foreach.hpp> 21 22 #include <boost/tokenizer.hpp> 22 23 #include <string> … … 153 154 } 154 155 156 void FormatParser< psi3 >::OutputPsi3Line(ostream * const out, const atom &_atom, const Vector *center) const 157 { 158 Vector recentered(_atom.getPosition()); 159 recentered -= *center; 160 *out << "\t( " << _atom.getType()->getSymbol() << "\t" << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " )" << endl; 161 }; 162 163 155 164 /** Saves all atoms and data into a PSI3 config file. 156 165 * \param *file output stream … … 220 229 *file << "\tgeometry = (" << std::endl; 221 230 // output of atoms 222 for (std::vector<atom *>::const_iterator AtomRunner = atoms.begin(); AtomRunner != atoms.end(); ++AtomRunner) {223 (*AtomRunner)->OutputPsi3Line(file, ¢er);231 BOOST_FOREACH(const atom *_atom, atoms) { 232 OutputPsi3Line(file, *_atom, ¢er); 224 233 } 225 234 *file << "\t)" << std::endl; -
src/Parser/Psi3Parser.hpp
rce7bfd r03a589 25 25 26 26 #include <iosfwd> 27 28 class Vector; 27 29 28 30 // declaration of specialized FormatParserTrait … … 59 61 60 62 private: 63 void OutputPsi3Line(ostream * const out, const atom &_atom, const Vector *center) const; 64 61 65 static ConvertTo<bool> Converter; 62 66 }; -
src/molecule.cpp
rce7bfd r03a589 866 866 }; 867 867 868 /** Prints molecule with all atomic trajectory positions to *out.869 * \param *out output stream870 */871 bool molecule::OutputTrajectories(ofstream * const output) const872 {873 if (output == NULL) {874 return false;875 } else {876 for (int step = 0; step < MDSteps; step++) {877 if (step == 0) {878 *output << "#Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon)" << endl;879 } else {880 *output << "# ====== MD step " << step << " =========" << endl;881 }882 int AtomNo[MAX_ELEMENTS];883 memset(AtomNo,0,(MAX_ELEMENTS-1)*sizeof(*AtomNo));884 enumeration<const element*> elementLookup = formula.enumerateElements();885 for_each(begin(),end(),boost::bind(&atom::OutputTrajectory,_1,output,elementLookup, AtomNo, (const int)step));886 }887 return true;888 }889 };890 891 868 /** Outputs contents of each atom::ListOfBonds. 892 869 * \param *out output stream … … 911 888 { 912 889 return formula.checkOut(output); 913 };914 915 /** Prints molecule with all its trajectories to *out as xyz file.916 * \param *out output stream917 */918 bool molecule::OutputTrajectoriesXYZ(ofstream * const output)919 {920 time_t now;921 922 if (output != NULL) {923 now = time((time_t *)NULL); // Get the system time and put it into 'now' as 'calender time'924 for (int step=0;step<MDSteps;step++) {925 *output << getAtomCount() << "\n\tCreated by molecuilder, step " << step << ", on " << ctime(&now);926 for_each(begin(),end(),boost::bind(&atom::OutputTrajectoryXYZ,_1,output,step));927 }928 return true;929 } else930 return false;931 };932 933 /** Prints molecule to *out as xyz file.934 * \param *out output stream935 */936 bool molecule::OutputXYZ(ofstream * const output) const937 {938 time_t now;939 940 if (output != NULL) {941 now = time((time_t *)NULL); // Get the system time and put it into 'now' as 'calender time'942 *output << getAtomCount() << "\n\tCreated by molecuilder on " << ctime(&now);943 for_each(begin(),end(),bind2nd(mem_fun(&atom::OutputXYZLine),output));944 return true;945 } else946 return false;947 890 }; 948 891 -
src/molecule.hpp
rce7bfd r03a589 270 270 // Output routines. 271 271 bool Output(std::ostream * const output) const; 272 bool OutputTrajectories(ofstream * const output) const;273 272 void OutputListOfBonds() const; 274 bool OutputXYZ(ofstream * const output) const;275 bool OutputTrajectoriesXYZ(ofstream * const output);276 273 bool Checkout(ofstream * const output) const; 277 274
Note:
See TracChangeset
for help on using the changeset viewer.