Skip to content

Commit

Permalink
full charmm point mutation support
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesKarwou committed Feb 20, 2024
1 parent 00db6a9 commit 71c7e17
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
34 changes: 23 additions & 11 deletions transformato/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,17 +627,23 @@ def _change_platform(self, file):
def _copy_ligand_specific_top_and_par(
self, basedir: str, intermediate_state_file_path: str
):
# copy ligand rtf file
ligand_rtf = f"{basedir}/waterbox/{self.system.tlc.lower()}/{self.system.tlc.lower()}_g.rtf"
toppar_target = (
f"{intermediate_state_file_path}/{self.system.tlc.lower()}_g.rtf"
)
shutil.copyfile(ligand_rtf, toppar_target)
# If the tlc is no name, we assume that there is no str/rtf file (as for point mutations in RNAs)
if len(self.system.tlc) > 3:
# copy ligand rtf file
ligand_rtf = f"{basedir}/waterbox/{self.system.tlc.lower()}/{self.system.tlc.lower()}_g.rtf"
toppar_target = (
f"{intermediate_state_file_path}/{self.system.tlc.lower()}_g.rtf"
)
shutil.copyfile(ligand_rtf, toppar_target)

# copy ligand prm file
ligand_prm = f"{basedir}/waterbox/{self.system.tlc.lower()}/{self.system.tlc.lower()}.prm"
toppar_target = f"{intermediate_state_file_path}/{self.system.tlc.lower()}.prm"
shutil.copyfile(ligand_prm, toppar_target)
# copy ligand prm file
ligand_prm = f"{basedir}/waterbox/{self.system.tlc.lower()}/{self.system.tlc.lower()}.prm"
toppar_target = (
f"{intermediate_state_file_path}/{self.system.tlc.lower()}.prm"
)
shutil.copyfile(ligand_prm, toppar_target)
else:
pass

def _copy_ligand_specific_str(
self, basedir: str, intermediate_state_file_path: str
Expand Down Expand Up @@ -1106,6 +1112,7 @@ def _write_toppar_str(self, output_file_base):
../../toppar/toppar_all36_lipid_model.str
../../toppar/toppar_all36_lipid_prot.str
../../toppar/toppar_all36_lipid_sphingo.str
../../toppar/toppar_all36_na_rna_modified.str
"""
if os.path.isfile(
f"{self.system.charmm_gui_base}/waterbox/{self.system.tlc.lower()}/{self.system.tlc.lower()}_g.rtf"
Expand All @@ -1115,10 +1122,15 @@ def _write_toppar_str(self, output_file_base):
dummy_atom_definitions.rtf
dummy_parameters.prm
"""
else:
elif len(self.system.tlc) > 3:
toppar_format += f"""{self.system.tlc.lower()}.str
dummy_atom_definitions.rtf
dummy_parameters.prm
"""
else:
toppar_format += f"""
dummy_atom_definitions.rtf
dummy_parameters.prm
"""

f = open(f"{output_file_base}/toppar.str", "w+")
Expand Down
1 change: 1 addition & 0 deletions transformato/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ def _read_parameters(self, env: str) -> pm.charmm.CharmmParameterSet:
parameter_files += (
f"{toppar_dir}/toppar_all36_prot_na_combined.str",
) # if modified aminoacids are needed
parameter_files += (f"{toppar_dir}/toppar_all36_na_rna_modified.str",)
if os.path.isfile(f"{toppar_dir}/toppar_all36_moreions.str"):
parameter_files += (f"{toppar_dir}/toppar_all36_moreions.str",)
# set up parameter objec
Expand Down

0 comments on commit 71c7e17

Please sign in to comment.