source: src/atom.hpp@ 174e0e

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 174e0e was 266237, checked in by Frederik Heber <heber@…>, 16 years ago

Huge refactoring: molecule::ListOfBondsPerAtom and molecule::NumberOfBondsPerAtom removed, atom::ListOfBonds introduced. Unit Test for ListOfBonds manipulation introduced.

  • changes to builder.cpp: removed CreateListOfBondsPerAtom() calls, as the creation of the global arrays is not necessary anymore
  • changes to LinkedCell: LinkedCell::CheckBounds(int[NDIM]) does not admonish out of bonds as this is not desired for the local offset which may become out of bounds.
  • changes to lists.hpp templates: BUGFIX: unlink() now sets ->next and ->previous to NULL, cleanup() uses removedwithoutcheck()
  • new templates for molecule.hpp: SumPerAtom() allows for summation of the return value of atom:...() member fiunctions. This is needed e.g. for atom::CorrectBondDegree()

Signed-off-by: Frederik Heber <heber@…>

  • Property mode set to 100644
File size: 5.1 KB
RevLine 
[357fba]1/*
2 * atom.hpp
3 *
4 * Created on: Aug 3, 2009
5 * Author: heber
6 */
7
8#ifndef ATOM_HPP_
9#define ATOM_HPP_
10
11using namespace std;
12
[f66195]13/*********************************************** includes ***********************************/
14
[cd4ccc]15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
20#include <iostream>
[266237]21#include <list>
[fcd7b6]22#include <vector>
[cd4ccc]23
[4a7776a]24#include <gsl/gsl_randist.h>
25
[357fba]26#include "tesselation.hpp"
[f66195]27
28/****************************************** forward declarations *****************************/
[357fba]29
[e41951]30class bond;
[4a7776a]31class config;
[f66195]32class element;
[ccd9f5]33class ForceMatrix;
[f66195]34class Vector;
35
[266237]36#define BondList list<bond *>
37
[f66195]38/********************************************** declarations *******************************/
[e41951]39
[357fba]40/** Single atom.
41 * Class incorporates position, type
42 */
43class atom : public TesselPoint {
44 public:
[fcd7b6]45 struct
46 {
47 vector<Vector> R; //!< position vector
48 vector<Vector> U; //!< velocity vector
49 vector<Vector> F; //!< last force vector
50 } Trajectory;
51
52 Vector x; //!< coordinate vector of atom, giving last position within cell
53 Vector v; //!< velocity vector of atom, giving last velocity within cell
54 Vector F; //!< Force vector of atom, giving last force within cell
[266237]55 BondList ListOfBonds; //!< list of all bonds
[357fba]56 element *type; //!< pointing to element
57 atom *previous; //!< previous atom in molecule list
58 atom *next; //!< next atom in molecule list
59 atom *father; //!< In many-body bond order fragmentations points to originating atom
60 atom *Ancestor; //!< "Father" in Depth-First-Search
61 //char *Name; //!< unique name used during many-body bond-order fragmentation, comes from TesselPoint
62 int FixedIon; //!< config variable that states whether forces act on the ion or not
63 int *sort; //!< sort criteria
64 //int nr; //!< continuous, unique number, comes from TesselPoint
65 int GraphNr; //!< unique number, given in DepthFirstSearchAnalysis()
66 int *ComponentNr;//!< belongs to this nonseparable components, given in DepthFirstSearchAnalysis() (if more than one, then is SeparationVertex)
67 int LowpointNr; //!< needed in DepthFirstSearchAnalysis() to detect nonseparable components, is the lowest possible number of an atom to reach via tree edges only followed by at most one back edge.
68 bool SeparationVertex; //!< whether this atom separates off subsets of atoms or not, determined in DepthFirstSearchAnalysis()
69 bool IsCyclic; //!< whether atom belong to as cycle or not, determined in DepthFirstSearchAnalysis()
70 unsigned char AdaptiveOrder; //!< current present bond order at site (0 means "not set")
71 bool MaxOrder; //!< whether this atom as a root in fragmentation still creates more fragments on higher orders or not
72
73 atom();
74 atom(class atom *pointer);
[055861]75 virtual ~atom();
[357fba]76
[fcd7b6]77 bool Output(ofstream *out, int ElementNo, int AtomNo, const char *comment = NULL) const;
78 bool Output(ofstream *out, int *ElementNo, int *AtomNo, const char *comment = NULL);
[357fba]79 bool OutputXYZLine(ofstream *out) const;
[fcd7b6]80 bool OutputTrajectory(ofstream *out, int *ElementNo, int *AtomNo, int step) const;
[681a8a]81 bool OutputTrajectoryXYZ(ofstream *out, int step) const;
[266237]82 bool OutputBondOfAtom(ofstream *out) const;
83 void OutputAdjacency(ofstream *AdjacencyFile) const;
84
[681a8a]85
[e65246]86 void EqualsFather ( atom *ptr, atom **res );
87 void CorrectFather();
[357fba]88 atom *GetTrueFather();
[ab1932]89 bool Compare(const atom &ptr);
[357fba]90
[4a7776a]91 // trajectory stuff
92 void ResizeTrajectory(int MaxSteps);
93 void CopyStepOnStep(int dest, int src);
94 void VelocityVerletUpdate(int MDSteps, config *configuration, ForceMatrix *Force);
95 void SumUpKineticEnergy( int Step, double *TotalMass, Vector *TotalVelocity );
96
[49f802c]97 double DistanceToVector(Vector &origin);
98 double DistanceSquaredToVector(Vector &origin);
99
[4a7776a]100 bool IsInParallelepiped(Vector offset, double *parallelepiped);
101
[5034e1]102 // bond order stuff
103 void OutputOrder(ofstream *file);
[266237]104 void OutputGraphInfo(ofstream *out) const;
105 void OutputComponentNumber(ofstream *out) const;
106 int CountBonds() const;
107 int CorrectBondDegree(ofstream *out);
108
109 bool RegisterBond(bond *Binder);
110 bool UnregisterBond(bond *Binder);
111 void UnregisterAllBond();
[5034e1]112
[4a7776a]113 // constraint potential and dynamics stuff
[49f802c]114 void AddKineticToTemperature(double *temperature, int step) const;
[ccd9f5]115 void EvaluateConstrainedForce(int startstep, int endstep, atom **PermutationMap, ForceMatrix *Force);
[4a7776a]116 void CorrectVelocity(double *ActualTemp, int Step, Vector *CoGVelocity);
117
118 // thermostats
119 void Thermostat_Woodcock(double ScaleTempFactor, int Step, double *ekin);
120 void Thermostat_Gaussian_init(int Step, double *G, double *E);
121 void Thermostat_Gaussian_least_constraint(int Step, double G_over_E, double *ekin, config *configuration);
122 void Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration);
123 void Thermostat_Berendsen(int Step, double ScaleTempFactor, double *ekin, config *configuration);
124 void Thermostat_NoseHoover_init(int Step, double *delta_alpha);
125 void Thermostat_NoseHoover_scale(int Step, double *ekin, config *configuration);
[49f802c]126
[e9f8f9]127
[055861]128 ostream & operator << (ostream &ost);
129
[357fba]130 private:
131};
132
133ostream & operator << (ostream &ost, const atom &a);
134
135#endif /* ATOM_HPP_ */
Note: See TracBrowser for help on using the repository browser.