Skip to content

Commit

Permalink
_fetch_singlepoints extracts the hessian SP record when ts optimizati…
Browse files Browse the repository at this point in the history
…on is requested
  • Loading branch information
hjnpark committed Oct 20, 2023
1 parent fc75aa9 commit a4711ee
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions qcportal/qcportal/neb/record_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ def _fetch_singlepoints(self):
self.singlepoints_cache_.setdefault(sp_info.chain_iteration, list())
self.singlepoints_cache_[sp_info.chain_iteration].append(sp_rec)

if len(self.singlepoints_cache_[max(self.singlepoints_cache_)]) == 1:
_, temp_list = self.singlepoints_cache_.popitem()
self.ts_hessian_ = temp_list[0]
assert self.ts_hessian_.specification.driver == 'hessian'

self.propagate_client(self._client)

def _fetch_initial_chain(self):
Expand Down Expand Up @@ -227,26 +232,18 @@ def initial_chain(self) -> List[Molecule]:

@property
def final_chain(self) -> List[SinglepointRecord]:
if self.optimizations.get("transition", None) is not None and self.ts_hessian_ is None:
self.singlepoints
return self.singlepoints[max(self.singlepoints.keys())]

@property
def ts_hessian(self) -> Optional[SinglepointRecord]:
if self.optimizations.get("transition", None) is not None:
if self.ts_hessian_ is None:
self.singlepoints
return self.ts_hessian_
else:
return None
if self.singlepoints_cache_ is None:
self._fetch_singlepoints()
return self.ts_hessian_

@property
def singlepoints(self) -> Dict[int, List[SinglepointRecord]]:
if self.singlepoints_cache_ is None:
self._fetch_singlepoints()
if self.optimizations.get("transition", None) is not None and self.ts_hessian_ is None:
_, temp_list = self.singlepoints_cache_.popitem()
self.ts_hessian_ = temp_list[0]
return self.singlepoints_cache_

@property
Expand Down

0 comments on commit a4711ee

Please sign in to comment.