source: src/Fragmentation/Exporters/SaturatedFragment.cpp@ de2cbf

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
Last change on this file since de2cbf was de2cbf, checked in by Frederik Heber <heber@…>, 11 years ago

Added SaturateFragment()::saturateAtom() replacing all cut bonds at once.

  • so far, we have just outsourced the loop over each cut bond into this function.
  • Property mode set to 100644
File size: 19.2 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2013 University of Bonn. All rights reserved.
5 * Copyright (C) 2013 Frederik Heber. All rights reserved.
6 *
7 *
8 * This file is part of MoleCuilder.
9 *
10 * MoleCuilder is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * MoleCuilder is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24/*
25 * SaturatedFragment.cpp
26 *
27 * Created on: Mar 3, 2013
28 * Author: heber
29 */
30
31// include config.h
32#ifdef HAVE_CONFIG_H
33#include <config.h>
34#endif
35
36#include "CodePatterns/MemDebug.hpp"
37
38#include "SaturatedFragment.hpp"
39
40#include <cmath>
41#include <iostream>
42
43#include "CodePatterns/Assert.hpp"
44#include "CodePatterns/Log.hpp"
45
46#include "LinearAlgebra/Exceptions.hpp"
47#include "LinearAlgebra/Plane.hpp"
48#include "LinearAlgebra/RealSpaceMatrix.hpp"
49#include "LinearAlgebra/Vector.hpp"
50
51#include "Atom/atom.hpp"
52#include "Bond/bond.hpp"
53#include "config.hpp"
54#include "Descriptors/AtomIdDescriptor.hpp"
55#include "Fragmentation/Exporters/HydrogenPool.hpp"
56#include "Fragmentation/HydrogenSaturation_enum.hpp"
57#include "Graph/BondGraph.hpp"
58#include "World.hpp"
59
60SaturatedFragment::SaturatedFragment(
61 const KeySet &_set,
62 KeySetsInUse_t &_container,
63 HydrogenPool &_hydrogens,
64 const enum HydrogenTreatment _treatment,
65 const enum HydrogenSaturation _saturation) :
66 container(_container),
67 set(_set),
68 hydrogens(_hydrogens),
69 FullMolecule(set),
70 treatment(_treatment),
71 saturation(_saturation)
72{
73 // add to in-use container
74 ASSERT( container.find(set) == container.end(),
75 "SaturatedFragment::SaturatedFragment() - the set "
76 +toString(set)+" is already marked as in use.");
77 container.insert(set);
78
79 // prepare saturation hydrogens
80 saturate();
81}
82
83SaturatedFragment::~SaturatedFragment()
84{
85 // release all saturation hydrogens if present
86 for (KeySet::iterator iter = SaturationHydrogens.begin();
87 !SaturationHydrogens.empty();
88 iter = SaturationHydrogens.begin()) {
89 hydrogens.releaseHydrogen(*iter);
90 SaturationHydrogens.erase(iter);
91 }
92
93 // remove ourselves from in-use container
94 KeySetsInUse_t::iterator iter = container.find(set);
95 ASSERT( container.find(set) != container.end(),
96 "SaturatedFragment::SaturatedFragment() - the set "
97 +toString(set)+" is not marked as in use.");
98 container.erase(iter);
99}
100
101void SaturatedFragment::saturate()
102{
103 // so far, we just have a set of keys. Hence, convert to atom refs
104 // and gather all atoms in a vector
105 std::vector<atom *> atoms;
106 for (KeySet::const_iterator iter = FullMolecule.begin();
107 iter != FullMolecule.end();
108 ++iter) {
109 atom * const Walker = World::getInstance().getAtom(AtomById(*iter));
110 ASSERT( Walker != NULL,
111 "SaturatedFragment::OutputConfig() - id "
112 +toString(*iter)+" is unknown to World.");
113 atoms.push_back(Walker);
114 }
115
116// bool LonelyFlag = false;
117 // go through each atom of the fragment and gather all cut bonds in list
118 typedef std::map<atom *, BondList > CutBonds_t;
119 CutBonds_t CutBonds;
120 for (std::vector<atom *>::const_iterator iter = atoms.begin();
121 iter != atoms.end();
122 ++iter) {
123 atom * const Walker = *iter;
124
125 // go through all bonds
126 const BondList& ListOfBonds = Walker->getListOfBonds();
127 for (BondList::const_iterator BondRunner = ListOfBonds.begin();
128 BondRunner != ListOfBonds.end();
129 ++BondRunner) {
130 atom * const OtherWalker = (*BondRunner)->GetOtherAtom(Walker);
131 // if other atom is in key set
132 if (set.find(OtherWalker->getId()) != set.end()) {
133 LOG(4, "DEBUG: Walker " << *Walker << " is bound to " << *OtherWalker << ".");
134// if (OtherWalker->getId() > Walker->getId()) { // add bond (Nr check is for adding only one of both variants: ab, ba)
135//// std::stringstream output;
136//// output << "ACCEPT: Adding Bond: "
137// output << Leaf->AddBond((*iter), OtherWalker, (*BondRunner)->getDegree());
138//// LOG(3, output.str());
139// //NumBonds[(*iter)->getNr()]++;
140// } else {
141//// LOG(3, "REJECY: Not adding bond, labels in wrong order.");
142// }
143// LonelyFlag = false;
144 } else {
145 LOG(4, "DEBUG: Walker " << *Walker << " is bound to "
146 << *OtherWalker << ", who is not in this fragment molecule.");
147 if (saturation == DoSaturate) {
148// LOG(3, "ACCEPT: Adding Hydrogen to " << (*iter)->Name << " and a bond in between.");
149 if (CutBonds.count(Walker) == 0)
150 CutBonds.insert( std::make_pair(Walker, BondList() ));
151 CutBonds[Walker].push_back(*BondRunner);
152 }
153// } else if ((treatment == ExcludeHydrogen) && (OtherWalker->getElementNo() == (atomicNumber_t)1)) {
154// // just copy the atom if it's a hydrogen
155// atom * const OtherWalker = Leaf->AddCopyAtom(OtherWalker);
156// Leaf->AddBond((*iter), OtherWalker, (*BondRunner)->getDegree());
157// }
158 //NumBonds[(*iter)->getNr()] += Binder->getDegree();
159 }
160 }
161 }
162
163 // go through all cut bonds and replace with a hydrogen
164 for (CutBonds_t::const_iterator atomiter = CutBonds.begin();
165 atomiter != CutBonds.end(); ++atomiter) {
166 atom * const Walker = atomiter->first;
167 if (!saturateAtom(Walker, atomiter->second))
168 exit(1);
169 }
170}
171
172bool SaturatedFragment::saturateAtom(
173 atom * const _atom,
174 const BondList &_cutbonds)
175{
176 // go through each bond and replace
177 for (BondList::const_iterator bonditer = _cutbonds.begin();
178 bonditer != _cutbonds.end(); ++bonditer) {
179 atom * const OtherWalker = (*bonditer)->GetOtherAtom(_atom);
180 if (!AddHydrogenReplacementAtom(
181 (*bonditer),
182 _atom,
183 OtherWalker,
184 World::getInstance().getConfig()->IsAngstroem == 1))
185 return false;
186 }
187 return true;
188}
189
190bool SaturatedFragment::OutputConfig(
191 std::ostream &out,
192 const ParserTypes _type) const
193{
194 // gather all atoms in a vector
195 std::vector<atom *> atoms;
196 for (KeySet::const_iterator iter = FullMolecule.begin();
197 iter != FullMolecule.end();
198 ++iter) {
199 atom * const Walker = World::getInstance().getAtom(AtomById(*iter));
200 ASSERT( Walker != NULL,
201 "SaturatedFragment::OutputConfig() - id "
202 +toString(*iter)+" is unknown to World.");
203 atoms.push_back(Walker);
204 }
205
206 // TODO: ScanForPeriodicCorrection() is missing so far!
207 // note however that this is not straight-forward for the following reasons:
208 // - we do not copy all atoms anymore, hence we are forced to shift the real
209 // atoms hither and back again
210 // - we use a long-range potential that supports periodic boundary conditions.
211 // Hence, there we would like the original configuration (split through the
212 // the periodic boundaries). Otherwise, we would have to shift (and probably
213 // interpolate) the potential with OBCs applying.
214
215 // list atoms in fragment for debugging
216 {
217 std::stringstream output;
218 output << "INFO: Contained atoms: ";
219 for (std::vector<atom *>::const_iterator iter = atoms.begin();
220 iter != atoms.end(); ++iter) {
221 output << (*iter)->getName() << " ";
222 }
223 LOG(3, output.str());
224 }
225
226 // store to stream via FragmentParser
227 const bool intermediateResult =
228 FormatParserStorage::getInstance().save(
229 out,
230 FormatParserStorage::getInstance().getSuffixFromType(_type),
231 atoms);
232
233 return intermediateResult;
234}
235
236atom * const SaturatedFragment::getHydrogenReplacement(atom * const replacement)
237{
238 atom * const _atom = hydrogens.leaseHydrogen(); // new atom
239 _atom->setAtomicVelocity(replacement->getAtomicVelocity()); // copy velocity
240 _atom->setFixedIon(replacement->getFixedIon());
241 // if we replace hydrogen, we mark it as our father, otherwise we are just an added hydrogen with no father
242 _atom->father = replacement;
243 SaturationHydrogens.insert(_atom->getId());
244 return _atom;
245}
246
247bool SaturatedFragment::AddHydrogenReplacementAtom(
248 bond::ptr TopBond,
249 atom *Origin,
250 atom *Replacement,
251 bool IsAngstroem)
252{
253// Info info(__func__);
254 bool AllWentWell = true; // flag gathering the boolean return value of molecule::AddAtom and other functions, as return value on exit
255 double bondlength; // bond length of the bond to be replaced/cut
256 double bondangle; // bond angle of the bond to be replaced/cut
257 double BondRescale; // rescale value for the hydrogen bond length
258 bond::ptr FirstBond;
259 bond::ptr SecondBond; // Other bonds in double bond case to determine "other" plane
260 atom *FirstOtherAtom = NULL, *SecondOtherAtom = NULL, *ThirdOtherAtom = NULL; // pointer to hydrogen atoms to be added
261 double b,l,d,f,g, alpha, factors[NDIM]; // hold temporary values in triple bond case for coordination determination
262 Vector Orthovector1, Orthovector2; // temporary vectors in coordination construction
263 Vector InBondvector; // vector in direction of *Bond
264 const RealSpaceMatrix &matrix = World::getInstance().getDomain().getM();
265 bond::ptr Binder;
266
267 // create vector in direction of bond
268 InBondvector = Replacement->getPosition() - Origin->getPosition();
269 bondlength = InBondvector.Norm();
270
271 // is greater than typical bond distance? Then we have to correct periodically
272 // the problem is not the H being out of the box, but InBondvector have the wrong direction
273 // due to Replacement or Origin being on the wrong side!
274 const BondGraph * const BG = World::getInstance().getBondGraph();
275 const range<double> MinMaxBondDistance(
276 BG->getMinMaxDistance(Origin,Replacement));
277 if (!MinMaxBondDistance.isInRange(bondlength)) {
278// LOG(4, "InBondvector is: " << InBondvector << ".");
279 Orthovector1.Zero();
280 for (int i=NDIM;i--;) {
281 l = Replacement->at(i) - Origin->at(i);
282 if (fabs(l) > MinMaxBondDistance.last) { // is component greater than bond distance (check against min not useful here)
283 Orthovector1[i] = (l < 0) ? -1. : +1.;
284 } // (signs are correct, was tested!)
285 }
286 Orthovector1 *= matrix;
287 InBondvector -= Orthovector1; // subtract just the additional translation
288 bondlength = InBondvector.Norm();
289// LOG(4, "INFO: Corrected InBondvector is now: " << InBondvector << ".");
290 } // periodic correction finished
291
292 InBondvector.Normalize();
293 // get typical bond length and store as scale factor for later
294 ASSERT(Origin->getType() != NULL,
295 "SaturatedFragment::AddHydrogenReplacementAtom() - element of Origin is not given.");
296 BondRescale = Origin->getType()->getHBondDistance(TopBond->getDegree()-1);
297 if (BondRescale == -1) {
298 ELOG(1, "There is no typical hydrogen bond distance in replacing bond (" << Origin->getName() << "<->" << Replacement->getName() << ") of degree " << TopBond->getDegree() << "!");
299 BondRescale = Origin->getType()->getHBondDistance(TopBond->getDegree());
300 if (BondRescale == -1) {
301 ELOG(1, "There is no typical hydrogen bond distance in replacing bond (" << Origin->getName() << "<->" << Replacement->getName() << ") of any degree!");
302 return false;
303 BondRescale = bondlength;
304 }
305 } else {
306 if (!IsAngstroem)
307 BondRescale /= (1.*AtomicLengthToAngstroem);
308 }
309
310 // discern single, double and triple bonds
311 switch(TopBond->getDegree()) {
312 case 1:
313 // check whether replacement has been an excluded hydrogen
314 if (Replacement->getType()->getAtomicNumber() == HydrogenPool::HYDROGEN) { // neither rescale nor replace if it's already hydrogen
315 FirstOtherAtom = Replacement;
316 BondRescale = bondlength;
317 } else {
318 FirstOtherAtom = getHydrogenReplacement(Replacement);
319 InBondvector *= BondRescale; // rescale the distance vector to Hydrogen bond length
320 FirstOtherAtom->setPosition(Origin->getPosition() + InBondvector); // set coordination to origin and add distance vector to replacement atom
321 }
322 FullMolecule.insert(FirstOtherAtom->getId());
323// LOG(4, "INFO: Added " << *FirstOtherAtom << " at: " << FirstOtherAtom->x << ".");
324 break;
325 case 2:
326 {
327 // determine two other bonds (warning if there are more than two other) plus valence sanity check
328 const BondList& ListOfBonds = Origin->getListOfBonds();
329 for (BondList::const_iterator Runner = ListOfBonds.begin();
330 Runner != ListOfBonds.end();
331 ++Runner) {
332 if ((*Runner) != TopBond) {
333 if (FirstBond == NULL) {
334 FirstBond = (*Runner);
335 FirstOtherAtom = (*Runner)->GetOtherAtom(Origin);
336 } else if (SecondBond == NULL) {
337 SecondBond = (*Runner);
338 SecondOtherAtom = (*Runner)->GetOtherAtom(Origin);
339 } else {
340 ELOG(2, "Detected more than four bonds for atom " << Origin->getName());
341 }
342 }
343 }
344 }
345 if (SecondOtherAtom == NULL) { // then we have an atom with valence four, but only 3 bonds: one to replace and one which is TopBond (third is FirstBond)
346 SecondBond = TopBond;
347 SecondOtherAtom = Replacement;
348 }
349 if (FirstOtherAtom != NULL) { // then we just have this double bond and the plane does not matter at all
350// LOG(3, "Regarding the double bond (" << Origin->Name << "<->" << Replacement->Name << ") to be constructed: Taking " << FirstOtherAtom->Name << " and " << SecondOtherAtom->Name << " along with " << Origin->Name << " to determine orthogonal plane.");
351
352 // determine the plane of these two with the *origin
353 try {
354 Orthovector1 = Plane(Origin->getPosition(), FirstOtherAtom->getPosition(), SecondOtherAtom->getPosition()).getNormal();
355 }
356 catch(LinearDependenceException &excp){
357 LOG(0, boost::diagnostic_information(excp));
358 // TODO: figure out what to do with the Orthovector in this case
359 AllWentWell = false;
360 }
361 } else {
362 Orthovector1.GetOneNormalVector(InBondvector);
363 }
364 //LOG(3, "INFO: Orthovector1: " << Orthovector1 << ".");
365 // orthogonal vector and bond vector between origin and replacement form the new plane
366 Orthovector1.MakeNormalTo(InBondvector);
367 Orthovector1.Normalize();
368 //LOG(3, "ReScaleCheck: " << Orthovector1.Norm() << " and " << InBondvector.Norm() << ".");
369
370 // create the two Hydrogens ...
371 FirstOtherAtom = getHydrogenReplacement(Replacement);
372 SecondOtherAtom = getHydrogenReplacement(Replacement);
373 FullMolecule.insert(FirstOtherAtom->getId());
374 FullMolecule.insert(SecondOtherAtom->getId());
375 bondangle = Origin->getType()->getHBondAngle(1);
376 if (bondangle == -1) {
377 ELOG(1, "There is no typical hydrogen bond angle in replacing bond (" << Origin->getName() << "<->" << Replacement->getName() << ") of degree " << TopBond->getDegree() << "!");
378 return false;
379 bondangle = 0;
380 }
381 bondangle *= M_PI/180./2.;
382// LOG(3, "INFO: ReScaleCheck: InBondvector " << InBondvector << ", " << Orthovector1 << ".");
383// LOG(3, "Half the bond angle is " << bondangle << ", sin and cos of it: " << sin(bondangle) << ", " << cos(bondangle));
384 FirstOtherAtom->Zero();
385 SecondOtherAtom->Zero();
386 for(int i=NDIM;i--;) { // rotate by half the bond angle in both directions (InBondvector is bondangle = 0 direction)
387 FirstOtherAtom->set(i, InBondvector[i] * cos(bondangle) + Orthovector1[i] * (sin(bondangle)));
388 SecondOtherAtom->set(i, InBondvector[i] * cos(bondangle) + Orthovector1[i] * (-sin(bondangle)));
389 }
390 FirstOtherAtom->Scale(BondRescale); // rescale by correct BondDistance
391 SecondOtherAtom->Scale(BondRescale);
392 //LOG(3, "ReScaleCheck: " << FirstOtherAtom->x.Norm() << " and " << SecondOtherAtom->x.Norm() << ".");
393 *FirstOtherAtom += Origin->getPosition();
394 *SecondOtherAtom += Origin->getPosition();
395 // ... and add to molecule
396// LOG(4, "INFO: Added " << *FirstOtherAtom << " at: " << FirstOtherAtom->x << ".");
397// LOG(4, "INFO: Added " << *SecondOtherAtom << " at: " << SecondOtherAtom->x << ".");
398 break;
399 case 3:
400 // take the "usual" tetraoidal angle and add the three Hydrogen in direction of the bond (height of the tetraoid)
401 FirstOtherAtom = getHydrogenReplacement(Replacement);
402 SecondOtherAtom = getHydrogenReplacement(Replacement);
403 ThirdOtherAtom = getHydrogenReplacement(Replacement);
404 FullMolecule.insert(FirstOtherAtom->getId());
405 FullMolecule.insert(SecondOtherAtom->getId());
406 FullMolecule.insert(ThirdOtherAtom->getId());
407
408 // we need to vectors orthonormal the InBondvector
409 AllWentWell = AllWentWell && Orthovector1.GetOneNormalVector(InBondvector);
410// LOG(3, "INFO: Orthovector1: " << Orthovector1 << ".");
411 try{
412 Orthovector2 = Plane(InBondvector, Orthovector1,0).getNormal();
413 }
414 catch(LinearDependenceException &excp) {
415 LOG(0, boost::diagnostic_information(excp));
416 AllWentWell = false;
417 }
418// LOG(3, "INFO: Orthovector2: " << Orthovector2 << ".")
419
420 // create correct coordination for the three atoms
421 alpha = (Origin->getType()->getHBondAngle(2))/180.*M_PI/2.; // retrieve triple bond angle from database
422 l = BondRescale; // desired bond length
423 b = 2.*l*sin(alpha); // base length of isosceles triangle
424 d = l*sqrt(cos(alpha)*cos(alpha) - sin(alpha)*sin(alpha)/3.); // length for InBondvector
425 f = b/sqrt(3.); // length for Orthvector1
426 g = b/2.; // length for Orthvector2
427// LOG(3, "Bond length and half-angle: " << l << ", " << alpha << "\t (b,d,f,g) = " << b << ", " << d << ", " << f << ", " << g << ", ");
428// LOG(3, "The three Bond lengths: " << sqrt(d*d+f*f) << ", " << sqrt(d*d+(-0.5*f)*(-0.5*f)+g*g) << ", " << sqrt(d*d+(-0.5*f)*(-0.5*f)+g*g));
429 factors[0] = d;
430 factors[1] = f;
431 factors[2] = 0.;
432 FirstOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
433 factors[1] = -0.5*f;
434 factors[2] = g;
435 SecondOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
436 factors[2] = -g;
437 ThirdOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
438
439 // rescale each to correct BondDistance
440// FirstOtherAtom->x.Scale(&BondRescale);
441// SecondOtherAtom->x.Scale(&BondRescale);
442// ThirdOtherAtom->x.Scale(&BondRescale);
443
444 // and relative to *origin atom
445 *FirstOtherAtom += Origin->getPosition();
446 *SecondOtherAtom += Origin->getPosition();
447 *ThirdOtherAtom += Origin->getPosition();
448
449 // ... and add to molecule
450// LOG(4, "INFO: Added " << *FirstOtherAtom << " at: " << FirstOtherAtom->x << ".");
451// LOG(4, "INFO: Added " << *SecondOtherAtom << " at: " << SecondOtherAtom->x << ".");
452// LOG(4, "INFO: Added " << *ThirdOtherAtom << " at: " << ThirdOtherAtom->x << ".");
453 break;
454 default:
455 ELOG(1, "BondDegree does not state single, double or triple bond!");
456 AllWentWell = false;
457 break;
458 }
459
460 return AllWentWell;
461};
Note: See TracBrowser for help on using the repository browser.