Skip to content

Commit

Permalink
compilation of bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lmseidler committed Nov 6, 2024
1 parent 4aae735 commit 1f23ec6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 34 deletions.
11 changes: 0 additions & 11 deletions src/censo/ensembleopt/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,6 @@ def _optimize(self, cut: bool = True) -> None:
for conf in self._ensemble.conformers:
self.data["results"][conf.name]["gtot"] = self._grrho(conf)

# sort conformers list with optimization key (gtot)
self._ensemble.conformers.sort(
key=lambda conf: self.data["results"][conf.name]["gtot"]
)

# sort conformers list with optimization key (gtot)
self.ensemble.conformers.sort(key=lambda conf: conf.results[self._name]["gtot"])

# calculate boltzmann weights from gtot values calculated here
self._update_results(self._calc_boltzmannweights())

Expand Down Expand Up @@ -348,9 +340,6 @@ def __macrocycle_opt(self, cut: bool):
# TODO - crestcheck each iteration if ncyc >= 6
# => replace this with molbar later

# sort conformers
self._ensemble.conformers.sort(key=self._grrho)

# remove converged conformers from 'todo-list'
for conf in list(
filter(
Expand Down
13 changes: 6 additions & 7 deletions src/censo/ensembleopt/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,18 @@ class respectively.
# print instructions
self._print_info()

# Print information about ensemble before optimization
self._print_update()
# Store number of conformer put in
self.data["nconf_in"] = len(self._ensemble.conformers)

# Perform the actual optimization logic
self._optimize(cut=cut)
self.data["nconf_out"] = len(self._ensemble.conformers)

# Resort the ensemble
self._ensemble.conformers.sort(
key=lambda conf: self.data["results"][conf.name]["gtot"],
)

# DONE

def _optimize(self, cut: bool = True):
Expand Down Expand Up @@ -277,11 +281,6 @@ def _print_update(self) -> None:
+ f"{len(self._ensemble.conformers)}"
)

# Make sure that the sorting is correct
self._ensemble.conformers.sort(
key=lambda conf: self.data["results"][conf.name]["gtot"]
)

print(
"Highest ranked conformer:".ljust(DIGILEN // 2, " ")
+ f"{self._ensemble.conformers[0].name}"
Expand Down
5 changes: 0 additions & 5 deletions src/censo/ensembleopt/prescreening.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ def _optimize(self, cut: bool = True) -> None:
# calculate free enthalpy
self.data["results"][conf.name]["gtot"] = self._gsolv(conf)

# sort conformers list with prescreening key (gtot)
self._ensemble.conformers.sort(
key=lambda conf: self.data["results"][conf.name]["gtot"],
)

# calculate boltzmann weights from gtot values calculated here
self._update_results(self._calc_boltzmannweights())

Expand Down
5 changes: 0 additions & 5 deletions src/censo/ensembleopt/refinement.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ def _optimize(self, cut: bool = True) -> None:
][conf.name]["xtb_rrho"]
self.data["results"][conf.name]["gtot"] = self._grrho(conf)

# sort conformers list
self._ensemble.conformers.sort(
key=lambda conf: self.data["results"][conf.name]["gtot"]
)

# calculate boltzmann weights from gtot values calculated here
# trying to get temperature from instructions, set it to room temperature if that fails for some reason
self._update_results(self._calc_boltzmannweights())
Expand Down
5 changes: 0 additions & 5 deletions src/censo/ensembleopt/screening.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ def _optimize(self, cut: bool = True) -> None:
# calculate new gtot including RRHO contribution
self.data["results"][conf.name]["gtot"] = self._grrho(conf)

# sort conformers list
self._ensemble.conformers.sort(
key=lambda conf: self.data["results"][conf.name]["gtot"]
)

if cut and len(self._ensemble.conformers) > 1:
# calculate fuzzyness of threshold (adds 1 kcal/mol at max to the threshold)
fuzzy = (1 / AU2KCAL) * (
Expand Down
2 changes: 1 addition & 1 deletion src/censo/properties/uvvis.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def __excitation_averaging(self):
# eps is a list of tuples that contain each excitation wavelength with the respective epsilon_max
eps = []
for conf in self._ensemble.conformers:
for excitation in conf.results[self.name]["uvvis"]["excitations"]:
for excitation in self.data["results"][conf.name]["excitations"]:
epsilon_max = (
self.data["results"][conf.name]["bmw"] * excitation["osc_str"]
)
Expand Down

0 comments on commit 1f23ec6

Please sign in to comment.