Skip to content

Commit 167768f

Browse files
committed
m_0: renamed atomic_or_weight
1 parent fcb3473 commit 167768f

File tree

5 files changed

+13
-192
lines changed

5 files changed

+13
-192
lines changed

docs/source/examples.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Creating a material input for water:
4141
water = pymcnp.inp.Material.from_formula(
4242
0,
4343
{'H2O': 1},
44-
atomic_or_weight=True,
44+
is_weight=True,
4545
)
4646
print(water.to_mcnp())
4747

@@ -67,7 +67,7 @@ Using a combination of more complicated materials:
6767
'K2O': 0.010,
6868
'CaSO4H4O2': 0.050,
6969
},
70-
atomic_or_weight=False,
70+
is_weight=False,
7171
)
7272
print(clinker_concrete.to_mcnp())
7373

examples/example_create_material_card.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
water = pymcnp.inp.Material.from_formula(
1616
0,
1717
{'H2O': 1},
18-
atomic_or_weight=True,
18+
is_weight=True,
1919
)
2020
print(water.to_mcnp())
2121

@@ -31,14 +31,14 @@
3131
'K2O': 0.010,
3232
'CaSO4H4O2': 0.050,
3333
},
34-
atomic_or_weight=False,
34+
is_weight=False,
3535
)
3636
print(clinker_concrete.to_mcnp())
3737

3838
print('\n### LANTHANUM(III) BROMIDE ###')
3939
labr3 = pymcnp.inp.Material.from_formula(
4040
2,
4141
{'LaBr3': 1},
42-
atomic_or_weight=True,
42+
is_weight=True,
4343
)
4444
print(labr3.to_mcnp())

scripts/inp_data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4375,14 +4375,14 @@ def draw(self):
43754375
],
43764376
extra='''
43774377
@staticmethod
4378-
def from_formula(number: int, formulas: dict[str, float], atomic_or_weight: bool = True):
4378+
def from_formula(number: int, formulas: dict[str, float], is_weight: bool = True):
43794379
"""
43804380
Generates ``M_0`` from INP.
43814381

43824382
Parameters:
43834383
number: Arbitrary material number.
43844384
formulas: Dictionary of formulas and atomic/weight fractions.
4385-
atomic_or_weight: Atomtic/Weight fraction true/false flag.
4385+
is_weight: Weight (atmoic) fraction true (false) flag.
43864386

43874387
Returns:
43884388
``M_0`` object.
@@ -4397,7 +4397,7 @@ def from_formula(number: int, formulas: dict[str, float], atomic_or_weight: bool
43974397
for element in composition:
43984398
compound_fraction = (
43994399
composition[element].fraction
4400-
if atomic_or_weight
4400+
if is_weight
44014401
else composition[element].mass / formula.mass
44024402
)
44034403

@@ -4413,7 +4413,7 @@ def from_formula(number: int, formulas: dict[str, float], atomic_or_weight: bool
44134413
types.Substance(
44144414
zaid,
44154415
types.Real(
4416-
(-1 if atomic_or_weight else 1)
4416+
(-1 if is_weight else 1)
44174417
* mixture_fraction
44184418
* compound_fraction
44194419
* isotropic_fraction

src/pymcnp/inp/data/M.py

Lines changed: 0 additions & 179 deletions
This file was deleted.

src/pymcnp/inp/data/M_0.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ def __init__(
6969
self.options: typing.Final[types.Tuple[m_0.MOption_0]] = options
7070

7171
@staticmethod
72-
def from_formula(number: int, formulas: dict[str, float], atomic_or_weight: bool = True):
72+
def from_formula(number: int, formulas: dict[str, float], is_weight: bool = True):
7373
"""
7474
Generates ``M_0`` from INP.
7575
7676
Parameters:
7777
number: Arbitrary material number.
7878
formulas: Dictionary of formulas and atomic/weight fractions.
79-
atomic_or_weight: Atomtic/Weight fraction true/false flag.
79+
is_weight: Weight (atomic) fraction true (false) flag.
8080
8181
Returns:
8282
``M_0`` object.
@@ -91,7 +91,7 @@ def from_formula(number: int, formulas: dict[str, float], atomic_or_weight: bool
9191
for element in composition:
9292
compound_fraction = (
9393
composition[element].fraction
94-
if atomic_or_weight
94+
if is_weight
9595
else composition[element].mass / formula.mass
9696
)
9797

@@ -107,7 +107,7 @@ def from_formula(number: int, formulas: dict[str, float], atomic_or_weight: bool
107107
types.Substance(
108108
zaid,
109109
types.Real(
110-
(-1 if atomic_or_weight else 1)
110+
(-1 if is_weight else 1)
111111
* mixture_fraction
112112
* compound_fraction
113113
* isotropic_fraction

0 commit comments

Comments
 (0)