Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
9ef1c8aa
Commit
9ef1c8aa
authored
4 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
Units: doxy explanation
parent
9ed843d4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Base/Const/Units.h
+13
-3
13 additions, 3 deletions
Base/Const/Units.h
with
13 additions
and
3 deletions
Base/Const/Units.h
+
13
−
3
View file @
9ef1c8aa
...
...
@@ -16,11 +16,21 @@
#define BORNAGAIN_BASE_CONST_UNITS_H
//! Constants and functions for physical unit conversions.
//!
//! In user code, quantities that have a physical dimension should always
//! be given in the form _value * unit_, e.g. 0.529 * angstrom for a length,
//! or 45 * deg for an angle.
//!
//! Internally, BornAgain has length, angle, magnetic field units of nanometer,
//! radians, Tesla. Therefore, in principle, the multipliers nm, rad, tesla could
//! be ommited from code. However, to make code more readable, and to prevent
//! misunderstandings, we recommend that physical dimension be always made clear
//! by multiplying values with an appropriate constant, even if this expands to 1.
namespace
Units
{
// Length
static
constexpr
double
nanometer
=
1.
;
static
constexpr
double
nanometer
=
1.
;
//!< Internal unit for lengths
static
constexpr
double
angstrom
=
1.e-1
*
nanometer
;
static
constexpr
double
micrometer
=
1.e+3
*
nanometer
;
static
constexpr
double
millimeter
=
1.e+6
*
nanometer
;
...
...
@@ -32,11 +42,11 @@ static constexpr double nm = nanometer;
static
constexpr
double
nm2
=
nanometer
*
nanometer
;
// Angle
static
constexpr
double
rad
=
1.
;
static
constexpr
double
rad
=
1.
;
//!< Radian, internal unit for angles
static
constexpr
double
deg
=
(
3.1415926535897932
/
180.0
)
*
rad
;
// Magnetic field
static
constexpr
double
tesla
=
1.
;
static
constexpr
double
tesla
=
1.
;
//!< Internal unit for magnetic fields
static
constexpr
double
gauss
=
1e-4
;
// Converters
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment