-
Notifications
You must be signed in to change notification settings - Fork 226
Add new entries in Physical Species properties (+ refactoring of the SpeciesPhysicalProperties file) #3090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new entries in Physical Species properties (+ refactoring of the SpeciesPhysicalProperties file) #3090
Conversation
|
Hi @lucafedeli88 , splendid :)
|
|
@lucafedeli88 please feel free to remove the I think we would use this in #3153 |
Docs/source/usage/parameters.rst
Outdated
| Currently, the accepted species are ``"electron"``, ``"positron"``, ``"photon"``, ``"hydrogen"`` (or equivalently ``"proton"``), ``"helium"`` (or equivalently ``"alpha"``), ``"boron"``, ``"carbon"``, ``"oxygen"``, ``"nitrogen"``, ``"argon"``, ``"copper"`` and ``"xenon"``. | ||
| Either this or both ``mass`` and ``charge`` have to be specified. | ||
| Currently, the accepted species are | ||
| ``"electron"``, ``"positron"``, ``"muon"``, ``"antimuon"``, ``"photon"``, ``"proton"`` , ``"alpha"``, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add neutron?
RemiLehe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this PR! This is very useful.
I added a few inline comments.
|
I have updated the values according to this NIST page Here is the Python script that I used in order to parse and re-format this data: import re
from scipy.constants import m_e, m_u
import periodictable
# Extract the element names from the package `periodictable`
element_names = {}
for el in periodictable.elements:
element_names[el.number] = el.name
# Read file (downloaded from
# https://physics.nist.gov/cgi-bin/Compositions/stand_alone.pl?ele=&ascii=ascii2&isotype=some
with open('./data.html') as f:
text = f.read()
# Parse the file to extract the numbers
atomic_data = re.findall(r'Atomic Number = (.*)\nAtomic Symbol = (.*)\nMass Number = (.*)\nRelative Atomic Mass = (\d+.\d*).*\n.*\nStandard Atomic Weight = (.*)', text)
# Go through the isotopes and print the information in the right format.
already_printed_Z_avg = []
for line in atomic_data:
Z = int(line[0])
N = line[2]
# Average property across isotopes
if Z <= 10 or element_names[Z] in ["aluminium", "argon", "copper", "xenon", "gold"]:
if Z not in already_printed_Z_avg:
already_printed_Z_avg.append(Z)
values = re.findall('\d+\.\d+', line[4])
n_digits = len(values[0])
m_avg = sum([ float(v) for v in values])/len(values)
m_avg = str(m_avg)[:n_digits]
print('{PhysicalSpecies::' + element_names[Z]
+ ', Properties{\n amrex::Real(' + str(m_avg)
+') * PhysConst::m_u,\n amrex::Real(' + str(Z) + ') * PhysConst::q_e}},')
# Properties specific to that isotope
m = line[3]
if Z <= 10:
print('{PhysicalSpecies::' + element_names[Z] + N
+ ', Properties{\n amrex::Real(' + str(m)
+') * PhysConst::m_u,\n amrex::Real(' + str(Z) + ') * PhysConst::q_e}},') |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
c416b0e to
73c8d9d
Compare
|
Latest update: |
|
Hi @RemiLehe. I've looked into the fusion test failing with this PR. Basically this is because the masses of helium and of boron11 have been changed (at the keV level, which is small but sufficient to trigger the CI test). There are a few places where this change needs to be taken into account:
I have tested with these changes locally and the CI tests almost passed, I just needed to make one more small modification here: https://github.com/ECP-WarpX/WarpX/blob/542ef3c09b467974b5bd9d1e3b25a208e3296562/Examples/Modules/nuclear_fusion/analysis_proton_boron_fusion.py#L384 |
|
@NeilZaim Thanks a lot for looking into this. |
|
@RemiLehe I don't think I have write access, so it's probably easier if you or @lucafedeli88 do the changes. |
|
OK, I have made the above-mentioned changes and have reset the benchmarks. |
…SpeciesPhysicalProperties file) (BLAST-WarpX#3090) * initial work * fixed bugs and added species * update documentation * delete unused file * Add neutron * Fix nuclear fusion * Reset benchmarks * Update values of mass and charge * Correct compilation error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: Remi Lehe <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This PR does mainly three things:
It adds new species to the possible
PhysicalSpecies(muon,antimuon,protium,deuterium,tritium,helium3,helium4,lithium,lithium6,lithium7,beryllium,carbon12,carbon13,nitrogen14,nitrogen15,oxygen16,oxygen17,oxygen18,fluorine,neon,neon20,neon21,neon22,aluminum,gold). All the stable isotopes with Z<=10 and selected heavier elements are provided.It consistently uses atomic mass units for the ion masses. Note that the mass of the
protonis now slightly different from the mass ofprotium, which includes the mass of the bound electron. Similarly, the mass ofalphais not exactly equal to the mass ofhelium4It refactors the
SpeciesPhysicalPropertiessource file. All the properties are now in a.cppfile and are stored usingstd::mapThe documentation has been updated to include the new options for the physical species.