RooParticle
Particle scattering simulator with ROOT
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
universalForce Class Reference

Newtonian gravity between the rest masses of two particles. Always attractive. More...

#include <force.hpp>

Inheritance diagram for universalForce:
force

Public Member Functions

 universalForce ()
 Make the force with G = 1.2331e-39 and no softening.
 
TVector3 Evaluate (particle *p1_, particle *p2_)
 Gravitational force on p1_ by p2_ (amu c^2/fm).
 
Double_t Potential (particle *p1_, particle *p2_)
 Gravitational potential energy of the pair (amu c^2).
 
void SetG (Double_t g_)
 Set the gravitational constant G.
 
Double_t GetG ()
 The gravitational constant G.
 
void SetSoftening (Double_t eps_)
 Set the softening length eps in fm (0 : none).
 
Double_t GetSoftening ()
 The softening length eps in fm.
 
- Public Member Functions inherited from force
virtual ~force ()
 Virtual : a force deleted through force* must run the subclass destructor.
 

Protected Attributes

Double_t gravityG = 1.2331e-39
 gravitational constant (amu^-1 c^2 fm)
 
Double_t softening = 0.
 softening length in fm
 

Additional Inherited Members

- Protected Member Functions inherited from force
 force ()
 Only subclasses can be made.
 

Detailed Description

Newtonian gravity between the rest masses of two particles. Always attractive.

\[ U = -\frac{G m_1 m_2}{r} \]

with the rest masses m1, m2 in amu (also in the relativistic mode) and G in amu^-1 c^2 fm. The default is the SI value converted to these units, \(G/c^2 \times 1\,\mathrm{amu} = 1.2331\times10^{-54}\,\mathrm{m} = 1.2331\times10^{-39}\,\mathrm{fm}\). The force on p1 is \(-G m_1 m_2 (\vec x_1 - \vec x_2)/r^3\), towards p2.

With softening eps [fm], r^2 is replaced by r^2 + eps^2 in the potential and the force is its exact gradient, as in coulombForce. Unlike coulombForce, the softened formula is always used, so eps = 0 gives inf or NaN for coinciding particles. With many bodies every pair attracts, so the force on a body is the vector sum over all the others.

Note
Until 2026-11 the default was 1.2331e-17, a wrong exponent (too strong by 1e22). At nuclear scales gravity is about 1e-36 of the Coulomb force between two protons.

Definition at line 104 of file force.hpp.

Constructor & Destructor Documentation

◆ universalForce()

universalForce::universalForce ( )
inline

Make the force with G = 1.2331e-39 and no softening.

Definition at line 107 of file force.hpp.

Member Function Documentation

◆ Evaluate()

TVector3 universalForce::Evaluate ( particle *  p1_,
particle *  p2_ 
)
virtual

Gravitational force on p1_ by p2_ (amu c^2/fm).

Reimplemented from force.

Definition at line 43 of file force.cpp.

◆ GetG()

Double_t universalForce::GetG ( )
inline

The gravitational constant G.

Definition at line 116 of file force.hpp.

◆ GetSoftening()

Double_t universalForce::GetSoftening ( )
inline

The softening length eps in fm.

Definition at line 120 of file force.hpp.

◆ Potential()

Double_t universalForce::Potential ( particle *  p1_,
particle *  p2_ 
)
virtual

Gravitational potential energy of the pair (amu c^2).

Reimplemented from force.

Definition at line 53 of file force.cpp.

◆ SetG()

void universalForce::SetG ( Double_t  g_)
inline

Set the gravitational constant G.

Definition at line 114 of file force.hpp.

◆ SetSoftening()

void universalForce::SetSoftening ( Double_t  eps_)
inline

Set the softening length eps in fm (0 : none).

Definition at line 118 of file force.hpp.

Member Data Documentation

◆ gravityG

Double_t universalForce::gravityG = 1.2331e-39
protected

gravitational constant (amu^-1 c^2 fm)

Definition at line 122 of file force.hpp.

◆ softening

Double_t universalForce::softening = 0.
protected

softening length in fm

Definition at line 123 of file force.hpp.


The documentation for this class was generated from the following files: