From 124cf0f3b08a65ddd2c4020e162c110d5cf4e959 Mon Sep 17 00:00:00 2001 From: Ethan-Norch <56433364+Ethan-Norch@users.noreply.github.com> Date: Thu, 22 Feb 2024 10:47:49 +0800 Subject: [PATCH 1/3] Update classical.py --- dmff/generators/classical.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dmff/generators/classical.py b/dmff/generators/classical.py index bb260b6f1..cc415623e 100644 --- a/dmff/generators/classical.py +++ b/dmff/generators/classical.py @@ -897,7 +897,7 @@ def overwrite(self, paramset): proper_phase = paramset[self.name]["proper_phase"] proper_k = paramset[self.name]["proper_k"] proper_shift = paramset[self.name]["proper_shift"] - proper_msks = paramset.mask[self.name]["proper"] + proper_msks = paramset.mask[self.name]["proper_phase"] for nnode, key in enumerate(self.proper_keys): self.ffinfo["Forces"][self.name]["node"][proper_node_indices[nnode]]["attrib"] = { } @@ -929,7 +929,7 @@ def overwrite(self, paramset): improper_phase = paramset[self.name]["improper_phase"] improper_k = paramset[self.name]["improper_k"] improper_shift = paramset[self.name]["improper_shift"] - improper_msks = paramset.mask[self.name]["improper"] + improper_msks = paramset.mask[self.name]["improper_phase"] for nnode, key in enumerate(self.imp_keys): self.ffinfo["Forces"][self.name]["node"][improper_node_indices[nnode]]["attrib"] = { } @@ -2028,7 +2028,7 @@ def overwrite(self, paramset: ParamSet) -> None: """ radius = paramset[self.name]["radius"] scale = paramset[self.name]["scale"] - for i in self.ffinfo.perParticleParamIndices: + for i in self.perParticleParamIndices: self.ffinfo["Forces"][self.name]["node"][i]["attrib"]["radius"] = str(radius[i]) self.ffinfo["Forces"][self.name]["node"][i]["attrib"]["scale"] = str(scale[i]) @@ -2109,4 +2109,4 @@ def potential_fn(positions: jnp.ndarray, box: jnp.ndarray, pairs: jnp.ndarray, p return potential_fn -_DMFFGenerators["CustomGBForce"] = CustomGBGenerator \ No newline at end of file +_DMFFGenerators["CustomGBForce"] = CustomGBGenerator From 5c789c3a45cd49a5c81022d54cf68569f7c58ecb Mon Sep 17 00:00:00 2001 From: Ethan-Norch <56433364+Ethan-Norch@users.noreply.github.com> Date: Fri, 23 Feb 2024 09:29:32 +0800 Subject: [PATCH 2/3] Update xmlio.py A little change in xmlio.py when reading and saving xml files in case some forcefield files contain text describtion. For example, there are lots of text describtion for some certain computed values needed to be saved when Hamiltonian rendering new forcefield XML files. --- dmff/api/xmlio.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dmff/api/xmlio.py b/dmff/api/xmlio.py index 26a9d5505..03afa30ff 100644 --- a/dmff/api/xmlio.py +++ b/dmff/api/xmlio.py @@ -123,6 +123,8 @@ def parseForce(self, nodes): inner = {} inner["name"] = child.tag inner["attrib"] = child.attrib + if child.text is not None: + inner["formula"] = child.text ret["node"].append(inner) return ret @@ -178,6 +180,8 @@ def writeXML( for node in force_info["node"]: subnode = ET.SubElement(fnode, node["name"]) subnode.attrib = genStrDict(node["attrib"]) + if "formula" in node: + subnode.text = node["formula"] tree = ET.ElementTree(root) xmlstr = minidom.parseString(ET.tostring(root)).toprettyxml(indent=" ") From f7cccc9be4d5218245a42cfe67bea7ab81c31315 Mon Sep 17 00:00:00 2001 From: Ethan-Norch <56433364+Ethan-Norch@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:55:21 +0800 Subject: [PATCH 3/3] Update classical.py Debug for CustomGBForce generator --- dmff/generators/classical.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dmff/generators/classical.py b/dmff/generators/classical.py index cc415623e..02da97ba4 100644 --- a/dmff/generators/classical.py +++ b/dmff/generators/classical.py @@ -2028,9 +2028,9 @@ def overwrite(self, paramset: ParamSet) -> None: """ radius = paramset[self.name]["radius"] scale = paramset[self.name]["scale"] - for i in self.perParticleParamIndices: - self.ffinfo["Forces"][self.name]["node"][i]["attrib"]["radius"] = str(radius[i]) - self.ffinfo["Forces"][self.name]["node"][i]["attrib"]["scale"] = str(scale[i]) + for j, i in enumerate(self.perParticleParamIndices): + self.ffinfo["Forces"][self.name]["node"][i]["attrib"]["radius"] = str(radius[j]) + self.ffinfo["Forces"][self.name]["node"][i]["attrib"]["scale"] = str(scale[j]) def _find_key_index(self, key: Tuple[str]) -> int: """