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
2 changes: 1 addition & 1 deletion src/scm/plams/interfaces/adfsuite/ams.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ def get_polarizability(self, engine: Optional[str] = None) -> np.ndarray:
[p_components[3], p_components[4], p_components[5]],
]
)
elif p_components.shape == (3, 3):
elif p_components.shape == (3, 3): # type: ignore[comparison-overlap]
polarizability_matrix = p_components
else:
raise ValueError(
Expand Down
2 changes: 1 addition & 1 deletion src/scm/plams/interfaces/adfsuite/crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def get_structure_energy(self, as_df: bool = False) -> Tuple[Optional[Dict], Opt
dict_species["NumRepMonmer"] = NumRepMonmer
dict_species["NumStrucPerComp"] = NumStrucPerComp

if np.sum(Assoc) > 0:
if np.sum(Assoc) > 0: # type: ignore[arg-type]
Assoc_s_idx = self.readkf(section, "Assoc_s_idx")
ReqCompIdxAssoc = self.readkf(section, "ReqCompIdxAssoc")
NumReqCompAssoc = self.readkf(section, "NumReqCompAssoc")
Expand Down
16 changes: 10 additions & 6 deletions src/scm/plams/interfaces/adfsuite/forcefieldparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def __add__(self, other: "ForceFieldPatch") -> "ForceFieldPatch":

return ret

def read_from_kf(self, kf: "KFFile") -> None:
def read_from_kf(self, kf: "KFFile", ipatch: int = 0) -> None:
"""
Read patch infor from kf
"""
Expand All @@ -161,7 +161,7 @@ def read_from_kf(self, kf: "KFFile") -> None:
npatches = kf.read_int("AMSResults", "Config.nPatches")
patch = ForceFieldPatch()
if npatches > 0:
patchtext = kf.read_string("AMSResults", "Config.FFPatch(1)")
patchtext = kf.read_string("AMSResults", f"Config.FFPatch({ipatch + 1})")
patch += ForceFieldPatch(patchtext)

for key in vars(patch):
Expand Down Expand Up @@ -297,9 +297,13 @@ def forcefield_params_from_kf(kf: "KFFile") -> Tuple[List[float], List[str], Opt
indices = kf.read_ints("AMSResults", "AtomTyping.atomIndexToType")
types = [alltypes[i - 1] for i in indices]

# Read the force field patch
patch = ForceFieldPatch()
patch.read_from_kf(kf)
if len(patch) == 0:
# Read the force field patches
npatches = kf.read_int("AMSResults", "Config.nPatches")
if npatches == 0:
return charges, types, None
patch = ForceFieldPatch()
for i in range(npatches):
p = ForceFieldPatch()
p.read_from_kf(kf, i)
patch += p
return charges, types, patch
Loading