Skip to content

Commit

Permalink
finished species page
Browse files Browse the repository at this point in the history
  • Loading branch information
lllx125 committed Jan 4, 2025
1 parent 1598033 commit 9d0a604
Show file tree
Hide file tree
Showing 6 changed files with 261 additions and 169 deletions.
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using Documenter, AtomicAndPhysicalConstants

makedocs(
sitename="AtomicAndPhysicalConstants.jl",
authors="Alex Coxe et al.",
authors="Alex Coxe, Lixing Li, Matt Signorelli, David Sagan et al.",
format=Documenter.HTMLWriter.HTML(size_threshold=nothing),
pages=
[
Expand Down
Binary file removed docs/src/Species.pdf
Binary file not shown.
28 changes: 13 additions & 15 deletions docs/src/constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Constants

## Available Constants
The macro `@APCdef` defines a set of physical constants with the provided set of units (For more details, see [this page](units.md)). The following example is how to use the macro and the phyical constants.
The macro `@APCdef` defines a set of physical constants with the provided set of units (For more details, see [this page](units.md)). The following example is how to use the macro and the physical constants.

```julia
julia> @APCdef
Expand All @@ -12,17 +12,17 @@ julia> C_LIGHT

### Constants Defined by @APCdef

#### Speed of light: `C_LIGHT`
#### Planck's constant: `H_PLANCK`
#### Reduced Planck's constant: `H_BAR_PLANCK`
#### Classical electron radius: `R_E`
#### Classical proton radius: `R_P`
#### Elementary charge: `E_CHARGE`
#### Vacuum permeability: `MU_0_VAC`
#### Permittivity of free space: `EPS_0_VAC`
#### Classical Radius Factor: `CLASSICAL_RADIUS_FACTOR`
#### Fine structure constant: `FINE_STRUCTURE`
#### Avogadro's constant: `N_AVOGADRO`
- Speed of light: `C_LIGHT`
- Planck's constant: `H_PLANCK`
- Reduced Planck's constant: `H_BAR_PLANCK`
- Classical electron radius: `R_E`
- Classical proton radius: `R_P`
- Elementary charge: `E_CHARGE`
- Vacuum permeability: `MU_0_VAC`
- Permittivity of free space: `EPS_0_VAC`
- Classical Radius Factor: `CLASSICAL_RADIUS_FACTOR`
- Fine structure constant: `FINE_STRUCTURE`
- Avogadro's constant: `N_AVOGADRO`

### Species Mass and Charge

Expand Down Expand Up @@ -51,6 +51,4 @@ The data are downloaded to the local file.

The isotope data are provided by NIST. We extract the isotope data from their database. The NIST doesn't store old releases, so the isotope data will always be the newest release.

The pion0 and pion+- data are provided by PDG(Particle Data Group). We extracted the data from the database of **pdgapi.lbl.gov**

## `setCODATA` usage
The pion0 and pion+- data are provided by PDG(Particle Data Group). We extracted the data from the database of **pdgapi.lbl.gov**
112 changes: 103 additions & 9 deletions docs/src/species.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Species

### Introduction
## Introduction

`Species` is a type to store the information of an particle.

A species is defined with the following fields:

Expand All @@ -12,10 +14,12 @@ struct Species
spin # spin of the particle
moment # magnetic moment of the particle
iso # mass number of atomic isotope
populated
kind # the kind of particle.
end;
```
The fields are stored with a set of units. If the fields are directly accessed, it will return a unitful value. For example:
There are 5 kinds of species: `ATOM` `HADRON` `LEPTON` `PHOTON` `NULL`. The kind of species is stored within the `kind` field.

The fields are stored with a set of units. If the fields are directly accessed, it will return a Unitful value. For example:
```julia
julia> Species("electron").mass
0.51099895069 MeV c^-2
Expand All @@ -26,15 +30,105 @@ The default units are:
- `spin`: $\hbar$
- `moment`: J/T

We recommended using our getter functions `massof()` an d `chargeof()` to obtain values in units you prefer. See [this page](units.md) for more information.
We recommended using our getter functions `massof()` an d `chargeof()` to obtain values in units you prefer. See [this page](constants.md) for more information.


## Construct a Species

Construct the particle with the constructor `Species(name)`.

### Constructing Subatomic Species

To construct a subatomic species, put the name of the subatomic species in the field `name`. **Note that the name must be provided exactly.**

Example:
```julia
julia> Species("electron")
```

To construct an antiparticle, prepend the prefix "anti-" in the front.

Example:
```julia
julia> Species("anti-proton")
```

See the list of all available subatomic species [here](#list-of-available-subatomic-species)

### Constructing Atomic Species

To construct an atomic species, put the following 3 things in `name`:

- Atomic Symbol
- "#" followed by the mass number of the atomic (optional)
- charge (optional)

Example:
```julia
julia> Species("C#13+") #Carbon-13 with a single positive charge
```

**Note**

- If mass number is not provided, the average will be used
- If charge is not provided, a neutral atom will be returned.
- charge can be provided by the following format
- "+" represents single positive charge
- "++" represents double positive charge
- "+n" represents n positive charge
- "-" represents single negative charge
- "--" represents double negative charge
- "-n" represents n negative charge

Example:
```julia
julia> Species("Al+4") #average Aluminum with 3 positive charge
```

### Alternative Way of Constructing Atomic Species

We also provide the constructor
```julia
Species(name::String, charge::Int, iso::Int)
```
where users can enter charge and mass number as separate parameter.

The parameter `charge` and `iso` are optional and it will use default values if not provided. Defaults are neutral atom and average atom.

**Note**

If charge or mass number are also provided in `name`. The charge and mass number in `name` will override the one given in the parameter.

Example:
```julia
julia> Species("C",charge = 1, iso = 13) #Carbon-13 with a single positive charge
```

### Construct a Species
## Species Functions

How contructors works
Species functions take a `Species` as their only parameter and returns a specific property of it. Here is the list of species functions:

### Particle Functions
- `massof()`
- `chargeof()`
- `atomicnumber()`
- `g_spin()`
- `gyromagnetic_anomaly()`
- `g_nucleon()`
- `fullname()`

mass of, charge of etc.
## List of Available subatomic species

### List of Available subatomic species
- `photon`
- `pion0`
- `pion+`
- `pion-`
- `muon`
- `anti-muon`
- `electron`
- `positron` or `anti-electron`
- `proton`
- `anti-proton`
- `neutron`
- `anti-neutron`
- `deuteron`
- `anti-deuteron`
8 changes: 4 additions & 4 deletions docs/src/units.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## @APCdef
### Description

`@APCdef` should be called at the initialization of the package. `@APCdef` sets the units for physical constants, species mass and charge. It defines the physical constants and getter functions for species mass and charge with the proper unit and data.
`@APCdef` should be called at the initialization of the package. `@APCdef` sets the units for physical constants, species mass and charge. It defines the physical constants and getter functions for species mass and charge with the proper unit and data, see [this page](constants.md) for more detail.

The user have the freedom to choose the unit they want for `mass`, `length`, `time`, `energy`, and `charge`. by using our predefined unitsystems `ACCELERATOR` (default), `MKS`, and `CGS` to quickly setup the units.

Expand All @@ -22,7 +22,7 @@ The users have the freedom to choose whether they want the constants to be of ty

`unitsystem` defines the set of units for the constants. There are 3 available options: `ACCELERATOR`,`MKS`,`CGS`. Default to `ACCELERATOR`.

`unitful` is a boolean. If it is set to `true`, the constants will be a Unitful type. If it is set to `false`, it will be a `Float64`. Defualt to `false`.
`unitful` is a boolean. If it is set to `true`, the constants will be a Unitful type. If it is set to `false`, it will be a `Float64`. Default to `false`.

`ACCELERATOR` units:
- `mass`: eV/c^2
Expand Down Expand Up @@ -82,7 +82,7 @@ julia> a.val

### Unit Conversions

Unitful provides a convient way to creat new units with expressions. Suffixs can also be directly added.
Unitful provides a convenent way to create new units with expressions. Prefix can also be directly added.
```julia
julia> m = 0.511u"MeV/c^2"
```
Expand All @@ -94,7 +94,7 @@ julia> uconvert(u"kg",m)

### Package-specific Units

`AtomicAndPhysicalConstants` defined 3 units that is not from the Unitful package. Within the package, users can directly use `@u_str` macro to acess these units, just like any other units.
`AtomicAndPhysicalConstants` defined 3 units that is not from the Unitful package. Within the package, users can directly use `@u_str` macro to access these units, just like any other units.

- `amu` : It represents the atomic mass unit.

Expand Down
Loading

0 comments on commit 9d0a604

Please sign in to comment.