Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pyxtal/optimize/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ def mutator(xtal, smiles, opt_lat, ref_pxrd=None, dr=0.125, random_state=None):
# perturb molecules
for i in range(1, len(x)):
disp_mol = rng.uniform(-1.0, 1.0, len(x[i]) - 1)
disp_mol[0] = 0 # x[i][0] is the Wyckoff index: scaling it moves special-site molecules
x[i][:-1] *= 1 + dr * disp_mol
# change the orientation and torsions
for j in range(3, len(x[i]) - 1):
Expand Down Expand Up @@ -756,7 +757,7 @@ def optimizer_par(
output_mlp,
check_stable,
pre_opt,
opt_lat=None,
opt_lat=True,
delta_length=1.0,
delta_angle=15.0,
xyz_only=False,
Expand Down Expand Up @@ -840,7 +841,7 @@ def optimizer_single(
output_mlp,
check_stable,
pre_opt,
opt_lat=None,
opt_lat=True,
delta_length=1.0,
delta_angle=15.0,
xyz_only=False,
Expand All @@ -857,9 +858,7 @@ def optimizer_single(
"""

# 1. Obtain the structure model
# Preserve the historical automatic behavior when no explicit choice is
# supplied, while allowing callers to relax a provided starting lattice.
opt_lat = lattice is None if opt_lat is None else bool(opt_lat)
opt_lat = lattice is None
if xtal is None:
xtal = randomizer(
smiles,
Expand Down
5 changes: 3 additions & 2 deletions pyxtal/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,9 @@ def to_pyxtal(self, smiles=None, composition=None, molecules=None):
site = mol_site.from_1D_dicts(dicts)

bypass = False
for mol_id, molecule in enumerate(struc.molecules):
if str(site.molecule) == str(molecule):
# do not reuse `molecule`: it holds the per-species template above
for mol_id, mol0 in enumerate(struc.molecules):
if str(site.molecule) == str(mol0):
site.type = mol_id
struc.numMols[mol_id] += site.wp.multiplicity
bypass = True
Expand Down
Loading