Skip to content

Commit faac2f3

Browse files
authored
Merge pull request #182 from pyiron/rename_fields
Rename fields() to keys()
2 parents c02d8d9 + 66f8a8b commit faac2f3

File tree

11 files changed

+35
-38
lines changed

11 files changed

+35
-38
lines changed

atomistics/calculators/ase.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ def volume(self):
6666

6767

6868
ASEOutputStatic = OutputStatic(
69-
**{k: getattr(ASEExecutor, k) for k in OutputStatic.fields()}
69+
**{k: getattr(ASEExecutor, k) for k in OutputStatic.keys()}
7070
)
7171

7272
ASEOutputMolecularDynamics = OutputMolecularDynamics(
73-
**{k: getattr(ASEExecutor, k) for k in OutputMolecularDynamics.fields()}
73+
**{k: getattr(ASEExecutor, k) for k in OutputMolecularDynamics.keys()}
7474
)
7575

7676

@@ -113,7 +113,7 @@ def evaluate_with_ase(
113113
def calc_static_with_ase(
114114
structure,
115115
ase_calculator,
116-
output_keys=OutputStatic.fields(),
116+
output_keys=OutputStatic.keys(),
117117
):
118118
return ASEOutputStatic.get(
119119
ASEExecutor(ase_structure=structure, ase_calculator=ase_calculator),
@@ -148,7 +148,7 @@ def calc_molecular_dynamics_npt_with_ase(
148148
pfactor=2e6 * units.GPa * (units.fs**2),
149149
temperature=100,
150150
externalstress=np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) * units.bar,
151-
output_keys=ASEOutputMolecularDynamics.fields(),
151+
output_keys=ASEOutputMolecularDynamics.keys(),
152152
):
153153
return _calc_md_step_with_ase(
154154
dyn=NPT(
@@ -182,7 +182,7 @@ def calc_molecular_dynamics_langevin_with_ase(
182182
timestep=1 * units.fs,
183183
temperature=100,
184184
friction=0.002,
185-
output_keys=ASEOutputMolecularDynamics.fields(),
185+
output_keys=ASEOutputMolecularDynamics.keys(),
186186
):
187187
return _calc_md_step_with_ase(
188188
dyn=Langevin(
@@ -232,7 +232,7 @@ def calc_molecular_dynamics_thermal_expansion_with_ase(
232232
ttime=100 * units.fs,
233233
pfactor=2e6 * units.GPa * (units.fs**2),
234234
externalstress=np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) * units.bar,
235-
output_keys=OutputThermalExpansionProperties.fields(),
235+
output_keys=OutputThermalExpansionProperties.keys(),
236236
):
237237
structure_current = structure.copy()
238238
temperature_lst = np.arange(

atomistics/calculators/lammps/calculator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def calc_static_with_lammps(
120120
structure,
121121
potential_dataframe,
122122
lmp=None,
123-
output_keys=LammpsOutputStatic.fields(),
123+
output_keys=LammpsOutputStatic.keys(),
124124
**kwargs,
125125
):
126126
template_str = LAMMPS_THERMO_STYLE + "\n" + LAMMPS_THERMO + "\n" + LAMMPS_RUN
@@ -151,7 +151,7 @@ def calc_molecular_dynamics_nvt_with_lammps(
151151
seed=4928459,
152152
dist="gaussian",
153153
lmp=None,
154-
output_keys=LammpsOutputMolecularDynamics.fields(),
154+
output_keys=LammpsOutputMolecularDynamics.keys(),
155155
**kwargs,
156156
):
157157
init_str = (
@@ -208,7 +208,7 @@ def calc_molecular_dynamics_npt_with_lammps(
208208
seed=4928459,
209209
dist="gaussian",
210210
lmp=None,
211-
output_keys=LammpsOutputMolecularDynamics.fields(),
211+
output_keys=LammpsOutputMolecularDynamics.keys(),
212212
**kwargs,
213213
):
214214
init_str = (
@@ -266,7 +266,7 @@ def calc_molecular_dynamics_nph_with_lammps(
266266
seed=4928459,
267267
dist="gaussian",
268268
lmp=None,
269-
output_keys=LammpsOutputMolecularDynamics.fields(),
269+
output_keys=LammpsOutputMolecularDynamics.keys(),
270270
**kwargs,
271271
):
272272
init_str = (
@@ -320,7 +320,7 @@ def calc_molecular_dynamics_langevin_with_lammps(
320320
seed=4928459,
321321
dist="gaussian",
322322
lmp=None,
323-
output_keys=LammpsOutputMolecularDynamics.fields(),
323+
output_keys=LammpsOutputMolecularDynamics.keys(),
324324
**kwargs,
325325
):
326326
init_str = (
@@ -380,7 +380,7 @@ def calc_molecular_dynamics_thermal_expansion_with_lammps(
380380
seed=4928459,
381381
dist="gaussian",
382382
lmp=None,
383-
output_keys=OutputThermalExpansionProperties.fields(),
383+
output_keys=OutputThermalExpansionProperties.keys(),
384384
**kwargs,
385385
):
386386
init_str = (

atomistics/calculators/lammps/helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def lammps_calc_md_step(
4646
lmp_instance,
4747
run_str,
4848
run,
49-
output_keys=LammpsOutputMolecularDynamics.fields(),
49+
output_keys=LammpsOutputMolecularDynamics.keys(),
5050
):
5151
run_str_rendered = Template(run_str).render(run=run)
5252
lmp_instance.interactive_lib_command(run_str_rendered)
@@ -58,7 +58,7 @@ def lammps_calc_md(
5858
run_str,
5959
run,
6060
thermo,
61-
output_keys=LammpsOutputMolecularDynamics.fields(),
61+
output_keys=LammpsOutputMolecularDynamics.keys(),
6262
):
6363
results_lst = [
6464
lammps_calc_md_step(
@@ -88,7 +88,7 @@ def lammps_thermal_expansion_loop(
8888
seed=4928459,
8989
dist="gaussian",
9090
lmp=None,
91-
output_keys=OutputThermalExpansionProperties.fields(),
91+
output_keys=OutputThermalExpansionProperties.keys(),
9292
**kwargs,
9393
):
9494
lmp_instance = lammps_run(

atomistics/calculators/qe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def volume(self):
2727

2828

2929
QuantumEspressoOutputStatic = OutputStatic(
30-
**{k: getattr(QEStaticParser, k) for k in OutputStatic.fields()}
30+
**{k: getattr(QEStaticParser, k) for k in OutputStatic.keys()}
3131
)
3232

3333

@@ -186,7 +186,7 @@ def calc_static_with_qe(
186186
pseudopotentials=None,
187187
tstress=True,
188188
tprnfor=True,
189-
output_keys=OutputStatic.fields(),
189+
output_keys=OutputStatic.keys(),
190190
**kwargs,
191191
):
192192
input_file_name = os.path.join(working_directory, calculation_name + ".pwi")

atomistics/shared/output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@dataclasses.dataclass
55
class Output:
66
@classmethod
7-
def fields(cls):
7+
def keys(cls):
88
return tuple(field.name for field in dataclasses.fields(cls))
99

1010
def get(self, engine, *output: str) -> dict:

atomistics/shared/thermal_expansion.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,5 @@ def temperatures(self):
1414

1515

1616
OutputThermalExpansionProperties = OutputThermalExpansion(
17-
**{
18-
k: getattr(ThermalExpansionProperties, k)
19-
for k in OutputThermalExpansion.fields()
20-
}
17+
**{k: getattr(ThermalExpansionProperties, k) for k in OutputThermalExpansion.keys()}
2118
)

atomistics/workflows/elastic/workflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
elastic_matrix_output_elastic = OutputElastic(
13-
**{k: getattr(ElasticProperties, k) for k in OutputElastic.fields()}
13+
**{k: getattr(ElasticProperties, k) for k in OutputElastic.keys()}
1414
)
1515

1616

@@ -44,7 +44,7 @@ def generate_structures(self):
4444
)
4545
return {"calc_energy": self._structure_dict}
4646

47-
def analyse_structures(self, output_dict, output_keys=OutputElastic.fields()):
47+
def analyse_structures(self, output_dict, output_keys=OutputElastic.keys()):
4848
"""
4949
5050
Args:

atomistics/workflows/evcurve/debye.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def volumes(self):
7777

7878

7979
DebyeOutputThermodynamic = OutputThermodynamic(
80-
**{k: getattr(DebyeThermalProperties, k) for k in OutputThermodynamic.fields()}
80+
**{k: getattr(DebyeThermalProperties, k) for k in OutputThermodynamic.keys()}
8181
)
8282

8383

@@ -232,7 +232,7 @@ def get_thermal_properties(
232232
temperatures=None,
233233
constant_volume=False,
234234
num_steps=50,
235-
output_keys=OutputThermodynamic.fields(),
235+
output_keys=OutputThermodynamic.keys(),
236236
):
237237
return DebyeOutputThermodynamic.get(
238238
DebyeThermalProperties(

atomistics/workflows/evcurve/workflow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def fit_dict(self):
130130
EnergyVolumeCurveOutputEnergyVolumeCurve = OutputEnergyVolumeCurve(
131131
**{
132132
k: getattr(EnergyVolumeCurveProperties, k)
133-
for k in OutputEnergyVolumeCurve.fields()
133+
for k in OutputEnergyVolumeCurve.keys()
134134
}
135135
)
136136

@@ -181,7 +181,7 @@ def generate_structures(self):
181181
return {"calc_energy": self._structure_dict}
182182

183183
def analyse_structures(
184-
self, output_dict, output_keys=OutputEnergyVolumeCurve.fields()
184+
self, output_dict, output_keys=OutputEnergyVolumeCurve.keys()
185185
):
186186
self._fit_dict = EnergyVolumeCurveOutputEnergyVolumeCurve.get(
187187
EnergyVolumeCurveProperties(
@@ -208,7 +208,7 @@ def get_thermal_properties(
208208
t_step=50,
209209
temperatures=None,
210210
constant_volume=False,
211-
output_keys=OutputThermodynamic.fields(),
211+
output_keys=OutputThermodynamic.keys(),
212212
):
213213
return get_thermal_properties(
214214
fit_dict=self.fit_dict,

atomistics/workflows/phonons/workflow.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ def volumes(self):
142142

143143

144144
PhonopyOutputPhonons = OutputPhonons(
145-
**{k: getattr(PhonopyProperties, k) for k in OutputPhonons.fields()}
145+
**{k: getattr(PhonopyProperties, k) for k in OutputPhonons.keys()}
146146
)
147147
PhonopyOutputThermodynamic = OutputThermodynamic(
148-
**{k: getattr(PhonopyThermalProperties, k) for k in OutputThermodynamic.fields()}
148+
**{k: getattr(PhonopyThermalProperties, k) for k in OutputThermodynamic.keys()}
149149
)
150150

151151

@@ -231,7 +231,7 @@ def _restore_magmoms(self, structure):
231231
structure.set_initial_magnetic_moments(magmoms)
232232
return structure
233233

234-
def analyse_structures(self, output_dict, output_keys=OutputPhonons.fields()):
234+
def analyse_structures(self, output_dict, output_keys=OutputPhonons.keys()):
235235
"""
236236
237237
Returns:
@@ -273,7 +273,7 @@ def get_thermal_properties(
273273
pretend_real=False,
274274
band_indices=None,
275275
is_projection=False,
276-
output_keys=OutputThermodynamic.fields(),
276+
output_keys=OutputThermodynamic.keys(),
277277
):
278278
"""
279279
Returns thermal properties at constant volume in the given temperature range. Can only be called after job

0 commit comments

Comments
 (0)