Skip to content
Open
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
21 changes: 21 additions & 0 deletions openpharmmdflow/pipeline/sm/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,39 @@ def solvate(self):
if m.to_smiles() == "[H][O][H]"
]
)
# Assign residue name for atoms in water molecule
for molecule in self.solvated_topology.molecules:
if molecule.to_smiles() == "[H][O][H]":
for atom in molecule.atoms:
if not hasattr(atom, "metadata") or atom.metadata is None:
atom.metadata = {}
atom.metadata["residue_name"] = "HOH"
# create a Sodium ion
self.sodium_ion = Molecule.from_smiles("[Na+]")
# find out the number of sodium ions in the system
self.n_sodium_ion = len(
[m for m in self.solvated_topology.molecules if m.to_smiles() == "[Na+]"]
)
# Assign residue name for atoms in Na ion
for molecule in self.solvated_topology.molecules:
if molecule.to_smiles() == "[Na+]":
for atom in molecule.atoms:
if not hasattr(atom, "metadata") or atom.metadata is None:
atom.metadata = {}
atom.metadata["residue_name"] = "NAP"
# create a Chlorine ion
self.chlorine_ion = Molecule.from_smiles("[Cl-]")
# find out the number of sodium ions in the system
self.n_chlorine_ion = len(
[m for m in self.solvated_topology.molecules if m.to_smiles() == "[Cl-]"]
)
# Assign residue name for atoms in Cl ion
for molecule in self.solvated_topology.molecules:
if molecule.to_smiles() == "[Cl-]":
for atom in molecule.atoms:
if not hasattr(atom, "metadata") or atom.metadata is None:
atom.metadata = {}
atom.metadata["residue_name"] = "[Cl-]"

# Apply residue names to water and ions added during solvation
# The write_residue_names function will automatically detect and name:
Expand Down
Loading