aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/picmi.py
diff options
context:
space:
mode:
authorGravatar David Grote <grote1@llnl.gov> 2020-11-16 11:54:25 -0800
committerGravatar GitHub <noreply@github.com> 2020-11-16 11:54:25 -0800
commit2a80fc156c48a16dc795d619c7503c2384ca6039 (patch)
treea5ea8b07d76804a7d8d2ab7135a316d3c163a531 /Python/pywarpx/picmi.py
parent98bfa97b33f248b599fe400cc86e68293c4decc8 (diff)
downloadWarpX-2a80fc156c48a16dc795d619c7503c2384ca6039.tar.gz
WarpX-2a80fc156c48a16dc795d619c7503c2384ca6039.tar.zst
WarpX-2a80fc156c48a16dc795d619c7503c2384ca6039.zip
Update picmi constants to match the values in PhysConst (#1483)
* Update picmi constants to match the values in PhysConst * In picmi, use string q_e for charge instead of float with charge_state = +-1 * Updated benchmarks of picmi tests
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r--Python/pywarpx/picmi.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py
index 7e7fbd9d4..aaf1ec98d 100644
--- a/Python/pywarpx/picmi.py
+++ b/Python/pywarpx/picmi.py
@@ -21,11 +21,12 @@ class constants:
# --- Put the constants in their own namespace
# --- Values from WarpXConst.H
c = 299792458.
- ep0 = 8.854187817e-12
- mu0 = 1.2566370614359173e-06
- q_e = 1.602176462e-19
- m_e = 9.10938291e-31
- m_p = 1.6726231e-27
+ ep0 = 8.8541878128e-12
+ mu0 = 1.25663706212e-06
+ q_e = 1.602176634e-19
+ m_e = 9.1093837015e-31
+ m_p = 1.67262192369e-27
+ hbar = 1.054571817e-34
class Species(picmistandard.PICMI_Species):
@@ -45,7 +46,12 @@ class Species(picmistandard.PICMI_Species):
if self.mass is None: self.mass = 'm_p'
else:
if self.charge is None and self.charge_state is not None:
- self.charge = self.charge_state*constants.q_e
+ if self.charge_state == +1.:
+ self.charge = 'q_e'
+ elif self.charge_state == -1.:
+ self.charge = '-q_e'
+ else:
+ self.charge = self.charge_state*constants.q_e
# Match a string of the format '#nXx', with the '#n' optional isotope number.
m = re.match('(?P<iso>#[\d+])*(?P<sym>[A-Za-z]+)', self.particle_type)
if m is not None: