Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Nov 15, 2023
1 parent f7c92fa commit bc5edc5
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 42 deletions.
11 changes: 5 additions & 6 deletions pymatgen/analysis/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, volumes, energies):
self.volumes = np.array(volumes)
self.energies = np.array(energies)
# minimum energy(e0), buk modulus(b0),
# derivative of bulk modulus wrt pressure(b1), minimum volume(v0)
# derivative of bulk modulus w.r.t. pressure(b1), minimum volume(v0)
self._params = None
# the eos function parameters. It is the same as _params except for
# equation of states that uses polynomial fits(delta_factor and
Expand Down Expand Up @@ -147,7 +147,7 @@ def b0_GPa(self):

@property
def b1(self):
"""Returns the derivative of bulk modulus wrt pressure(dimensionless)."""
"""Returns the derivative of bulk modulus w.r.t. pressure(dimensionless)."""
return self._params[2]

@property
Expand Down Expand Up @@ -191,7 +191,7 @@ def plot(self, width=8, height=None, ax: plt.Axes = None, dpi=None, **kwargs):
f"Minimum energy = {self.e0:1.2f} eV",
f"Minimum or reference volume = {self.v0:1.2f} Ang^3",
f"Bulk modulus = {self.b0:1.2f} eV/Ang^3 = {self.b0_GPa:1.2f} GPa",
f"Derivative of bulk modulus wrt pressure = {self.b1:1.2f}",
f"Derivative of bulk modulus w.r.t. pressure = {self.b1:1.2f}",
]
text = "\n".join(lines)
text = kwargs.get("text", text)
Expand Down Expand Up @@ -239,7 +239,7 @@ def plot_ax(self, ax: plt.Axes = None, fontsize=12, **kwargs):
f"Minimum energy = {self.e0:1.2f} eV",
f"Minimum or reference volume = {self.v0:1.2f} Ang^3",
f"Bulk modulus = {self.b0:1.2f} eV/Ang^3 = {self.b0_GPa:1.2f} GPa",
f"Derivative of bulk modulus wrt pressure = {self.b1:1.2f}",
f"Derivative of bulk modulus w.r.t. pressure = {self.b1:1.2f}",
]
text = "\n".join(lines)
text = kwargs.get("text", text)
Expand Down Expand Up @@ -357,8 +357,7 @@ def _set_params(self):
and set to the _params attribute.
"""
fit_poly = np.poly1d(self.eos_params)
# the volume at min energy, used as the initial guess for the
# optimization wrt volume.
# the volume at min energy, used as the initial guess for the optimization w.r.t. volume.
v_e_min = self.volumes[np.argmin(self.energies)]
# evaluate e0, v0, b0 and b1
min_wrt_v = minimize(fit_poly, v_e_min)
Expand Down
4 changes: 2 additions & 2 deletions pymatgen/analysis/phase_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -2374,7 +2374,7 @@ class (pymatgen.analysis.chempot_diagram).
Args:
elements: Sequence of elements to be considered as independent
variables. E.g., if you want to show the stability ranges of
all Li-Co-O phases wrt to uLi and uO, you will supply
all Li-Co-O phases w.r.t. to uLi and uO, you will supply
[Element("Li"), Element("O")]
referenced: if True, gives the results with a reference being the
energy of the elemental phase. If False, gives absolute values.
Expand All @@ -2392,7 +2392,7 @@ class (pymatgen.analysis.chempot_diagram).
Args:
elements: Sequence of elements to be considered as independent
variables. E.g., if you want to show the stability ranges of
all Li-Co-O phases wrt to uLi and uO, you will supply
all Li-Co-O phases w.r.t. to uLi and uO, you will supply
[Element("Li"), Element("O")]
referenced: if True, gives the results with a reference being the
energy of the elemental phase. If False, gives absolute values.
Expand Down
15 changes: 7 additions & 8 deletions pymatgen/analysis/quasiharmonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def __init__(
def optimize_gibbs_free_energy(self):
"""
Evaluate the Gibbs free energy as a function of V, T and P i.e
G(V, T, P), minimize G(V, T, P) wrt V for each T and store the
G(V, T, P), minimize G(V, T, P) w.r.t. V for each T and store the
optimum values.
Note: The data points for which the equation of state fitting fails
Expand All @@ -146,8 +146,7 @@ def optimize_gibbs_free_energy(self):

def optimizer(self, temperature):
"""
Evaluate G(V, T, P) at the given temperature(and pressure) and
minimize it wrt V.
Evaluate G(V, T, P) at the given temperature(and pressure) and minimize it w.r.t. V.
1. Compute the vibrational Helmholtz free energy, A_vib.
2. Compute the Gibbs free energy as a function of volume, temperature
Expand All @@ -171,7 +170,7 @@ def optimizer(self, temperature):

# fit equation of state, G(V, T, P)
eos_fit = self.eos.fit(self.volumes, G_V)
# minimize the fit eos wrt volume
# minimize the fit EoS w.r.t. volume
# Note: the ref energy and the ref volume(E0 and V0) not necessarily
# the same as minimum energy and min volume.
volume_guess = eos_fit.volumes[np.argmin(eos_fit.energies)]
Expand Down Expand Up @@ -288,13 +287,13 @@ def gruneisen_parameter(self, temperature, volume):
"""
if isinstance(self.eos, PolynomialEOS):
p = np.poly1d(self.eos.eos_params)
# first derivative of energy at 0K wrt volume evaluated at the
# first derivative of energy at 0K w.r.t. volume evaluated at the
# given volume, in eV/Ang^3
dEdV = np.polyder(p, 1)(volume)
# second derivative of energy at 0K wrt volume evaluated at the
# second derivative of energy at 0K w.r.t. volume evaluated at the
# given volume, in eV/Ang^6
d2EdV2 = np.polyder(p, 2)(volume)
# third derivative of energy at 0K wrt volume evaluated at the
# third derivative of energy at 0K w.r.t. volume evaluated at the
# given volume, in eV/Ang^9
d3EdV3 = np.polyder(p, 3)(volume)
else:
Expand All @@ -314,7 +313,7 @@ def gruneisen_parameter(self, temperature, volume):
)

# Slater-gamma formulation
# first derivative of bulk modulus wrt volume, eV/Ang^6
# first derivative of bulk modulus w.r.t. volume, eV/Ang^6
dBdV = d2EdV2 + d3EdV3 * volume
return -(1.0 / 6.0 + 0.5 * volume * dBdV / FloatWithUnit(self.ev_eos_fit.b0_GPa, "GPa").to("eV ang^-3"))

Expand Down
18 changes: 9 additions & 9 deletions pymatgen/analysis/surface_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ def chempot_vs_gamma_plot_one(
chempot_range = sorted(chempot_range)

# use dashed lines for slabs that are not stoichiometric
# wrt bulk. Label with formula if non-stoichiometric
# w.r.t. bulk. Label with formula if non-stoichiometric
ucell_comp = self.ucell_entry.composition.reduced_composition
if entry.adsorbates:
s = entry.cleaned_up_slab
Expand Down Expand Up @@ -1134,7 +1134,7 @@ def surface_chempot_range_map(
delu_dict=None,
ax=None,
annotate=True,
show_unphyiscal_only=False,
show_unphysical_only=False,
fontsize=10,
) -> plt.Axes:
"""
Expand All @@ -1143,14 +1143,14 @@ def surface_chempot_range_map(
energy stability. Currently works only for 2-component PDs. At
the moment uses a brute force method by enumerating through the
range of the first element chempot with a specified increment
and determines the chempot rangeo fht e second element for each
and determines the chempot range of the second element for each
SlabEntry. Future implementation will determine the chempot range
map first by solving systems of equations up to 3 instead of 2.
Args:
elements (list): Sequence of elements to be considered as independent
variables. E.g., if you want to show the stability ranges of
all Li-Co-O phases wrt to duLi and duO, you will supply
all Li-Co-O phases w.r.t. to duLi and duO, you will supply
[Element("Li"), Element("O")]
miller_index ([h, k, l]): Miller index of the surface we are interested in
ranges ([[range1], [range2]]): List of chempot ranges (max and min values)
Expand All @@ -1164,7 +1164,7 @@ def surface_chempot_range_map(
ax (plt.Axes): Axes object to plot on. If None, will create a new plot.
annotate (bool): Whether to annotate each "phase" with the label of
the entry. If no label, uses the reduced formula
show_unphyiscal_only (bool): Whether to only show the shaded region where
show_unphysical_only (bool): Whether to only show the shaded region where
surface energy is negative. Useful for drawing other chempot range maps.
fontsize (int): Font size of the annotation
"""
Expand Down Expand Up @@ -1219,15 +1219,15 @@ def surface_chempot_range_map(
neg_dmu_range = [pt1[delu2][0][1], pt1[delu2][0][2]]
# Shade the threshold and region at which se<=0
ax.plot([pt1[delu1], pt1[delu1]], neg_dmu_range, "k--")
elif pt1[delu2][1][0] < 0 and pt1[delu2][1][1] < 0 and not show_unphyiscal_only:
elif pt1[delu2][1][0] < 0 and pt1[delu2][1][1] < 0 and not show_unphysical_only:
# Any chempot at this point will result
# in se<0, shade the entire y range
ax.plot([pt1[delu1], pt1[delu1]], range2, "k--")

if ii == len(vertex) - 1:
break
pt2 = vertex[ii + 1]
if not show_unphyiscal_only:
if not show_unphysical_only:
ax.plot(
[pt1[delu1], pt2[delu1]],
[pt1[delu2][0][0], pt2[delu2][0][0]],
Expand All @@ -1243,7 +1243,7 @@ def surface_chempot_range_map(
delu1, delu2 = pt
xvals.extend([pt[delu1], pt[delu1]])
yvals.extend(pt[delu2][0])
if not show_unphyiscal_only:
if not show_unphysical_only:
ax.plot([pt[delu1], pt[delu1]], [pt[delu2][0][0], pt[delu2][0][-1]], "k")

if annotate:
Expand Down Expand Up @@ -1595,7 +1595,7 @@ class NanoscaleStability:
polymorphs with respect to size. The Wulff shape will be the model for the
nanoparticle. Stability will be determined by an energetic competition between the
weighted surface energy (surface energy of the Wulff shape) and the bulk energy. A
future release will include a 2D phase diagram (e.g. wrt size vs chempot for adsorbed
future release will include a 2D phase diagram (e.g. w.r.t. size vs chempot for adsorbed
or non-stoichiometric surfaces). Based on the following work:
Kang, S., Mo, Y., Ong, S. P., & Ceder, G. (2014). Nanoscale
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/command_line/gulp_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"spatial",
"storevectors",
"nomolecularinternalke",
"voight",
"voigt",
"zsisa",
# Optimization method
"conjugate",
Expand Down
22 changes: 11 additions & 11 deletions pymatgen/core/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,23 +1125,23 @@ def repair_broken_bonds(self, slab, bonds):
(Slab) A Slab object with a particular shifted oriented unit cell.
"""
for pair in bonds:
blength = bonds[pair]
bond_len = bonds[pair]

# First lets determine which element should be the
# reference (center element) to determine broken bonds.
# e.g. P for a PO4 bond. Find integer coordination
# numbers of the pair of elements wrt to each other
# numbers of the pair of elements w.r.t. to each other
cn_dict = {}
for i, el in enumerate(pair):
cnlist = []
cn_list = []
for site in self.oriented_unit_cell:
poly_coord = 0
if site.species_string == el:
for nn in self.oriented_unit_cell.get_neighbors(site, blength):
for nn in self.oriented_unit_cell.get_neighbors(site, bond_len):
if nn[0].species_string == pair[i - 1]:
poly_coord += 1
cnlist.append(poly_coord)
cn_dict[el] = cnlist
cn_list.append(poly_coord)
cn_dict[el] = cn_list

# We make the element with the higher coordination our reference
if max(cn_dict[pair[0]]) > max(cn_dict[pair[1]]):
Expand All @@ -1153,7 +1153,7 @@ def repair_broken_bonds(self, slab, bonds):
# Determine the coordination of our reference
if site.species_string == element1:
poly_coord = 0
for neighbor in slab.get_neighbors(site, blength):
for neighbor in slab.get_neighbors(site, bond_len):
poly_coord += 1 if neighbor.species_string == element2 else 0

# suppose we find an undercoordinated reference atom
Expand All @@ -1164,7 +1164,7 @@ def repair_broken_bonds(self, slab, bonds):

# find its NNs with the corresponding
# species it should be coordinated with
neighbors = slab.get_neighbors(slab[i], blength, include_index=True)
neighbors = slab.get_neighbors(slab[i], bond_len, include_index=True)
to_move = [nn[2] for nn in neighbors if nn[0].species_string == element2]
to_move.append(i)
# and then move those NNs along with the central
Expand Down Expand Up @@ -1237,7 +1237,7 @@ def nonstoichiometric_symmetrized_slab(self, init_slab):
if init_slab.is_symmetric():
return [init_slab]

nonstoich_slabs = []
non_stoich_slabs = []
# Build an equivalent surface slab for each of the different surfaces
for top in [True, False]:
asym = True
Expand All @@ -1261,12 +1261,12 @@ def nonstoichiometric_symmetrized_slab(self, init_slab):
# Check if the altered surface is symmetric
if slab.is_symmetric():
asym = False
nonstoich_slabs.append(slab)
non_stoich_slabs.append(slab)

if len(slab) <= len(self.parent):
warnings.warn("Too many sites removed, please use a larger slab size.")

return nonstoich_slabs
return non_stoich_slabs


module_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down
8 changes: 4 additions & 4 deletions pymatgen/core/tensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def symmetrized(self):
@property
def voigt_symmetrized(self):
"""Returns a "voigt"-symmetrized tensor, i. e. a voigt-notation
tensor such that it is invariant wrt permutation of indices.
tensor such that it is invariant w.r.t. permutation of indices.
"""
if not (self.rank % 2 == 0 and self.rank >= 2):
raise ValueError("V-symmetrization requires rank even and >= 2")
Expand Down Expand Up @@ -567,7 +567,7 @@ def populate(
Args:
structure (Structure): structure to base population on
prec (float): precision for determining a non-zero value
prec (float): precision for determining a non-zero value. Defaults to 1e-5.
maxiter (int): maximum iterations for populating the tensor
verbose (bool): whether to populate verbosely
precond (bool): whether to precondition by cycling through
Expand Down Expand Up @@ -747,7 +747,7 @@ def is_fit_to_structure(self, structure: Structure, tol: float = 1e-2):

@property
def voigt(self):
"""TensorCollection where all tensors are in voight form."""
"""TensorCollection where all tensors are in Voigt form."""
return [t.voigt for t in self]

@property
Expand Down Expand Up @@ -804,7 +804,7 @@ def voigt_symmetrized(self):
return self.__class__([t.voigt_symmetrized for t in self])

def as_dict(self, voigt=False):
""":param voigt: Whether to use voight form.
""":param voigt: Whether to use Voigt form.
Returns:
Dict representation of TensorCollection.
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/io/abinit/abiobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def lattice_from_abivars(cls=None, *args, **kwargs):
and abs(ang_deg[0] - 90.0) + abs(ang_deg[1] - 90.0) + abs(ang_deg[2] - 90) > tol12
):
# Treat the case of equal angles (except all right angles):
# generates trigonal symmetry wrt third axis
# generates trigonal symmetry w.r.t. third axis
cos_ang = cos(pi * ang_deg[0] / 180.0)
a2 = 2.0 / 3.0 * (1.0 - cos_ang)
aa = sqrt(a2)
Expand Down

0 comments on commit bc5edc5

Please sign in to comment.