Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self.composition_col in df.columns:
logger.info(
self._log_prefix + "composition column already exists, "
"overwriting with composition from structure."
)
else:
logger.info(
self._log_prefix + "Adding compositions from structures."
)
df = self._tidy_column(df, self.structure_col)
# above tidy column will add oxidation states, these oxidation
# states will then be transferred to composition.
struct2comp = StructureToComposition(
reduce=True,
target_col_id=self.composition_col,
overwrite_data=overwrite,
)
struct2comp.set_n_jobs(self.n_jobs)
df = struct2comp.featurize_dataframe(df, self.structure_col)
return df
"hl_mass_x": "hole mass_x",
"hl_mass_y": "hole mass_y",
"hl_mass_z": "hole mass_z",
"kv": "bulk modulus",
"magmom": "mu_b",
"mbj_gap": "gap tbmbj",
"mepsx": "epsilon_x tbmbj",
"mepsy": "epsilon_y tbmbj",
"mepsz": "epsilon_z tbmbj",
"op_gap": "gap tbmbj",
"strt": "structure",
}
df = df.rename(columns=colmap)
df = df.drop(["multi_elastic", "fin_enp"], axis=1)
s = StructureToComposition()
df = s.featurize_dataframe(df, "structure")
return df