Skip to content

Commit

Permalink
Merge pull request #496 from carlocamilloni/main
Browse files Browse the repository at this point in the history
small fixes, more regtests
  • Loading branch information
carlocamilloni authored Dec 5, 2024
2 parents 4dab8d7 + 86cfab5 commit f3efb0c
Show file tree
Hide file tree
Showing 44 changed files with 9,805 additions and 20 deletions.
2 changes: 0 additions & 2 deletions multi-ego-ready.ff/README.md

This file was deleted.

14 changes: 11 additions & 3 deletions src/multiego/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def generate_14_data(meGO_ensemble):
# First of all we generate the random-coil 1-4 interactions:
pairs14 = pd.DataFrame()
exclusion_bonds14 = pd.DataFrame()
for molecule, bond_pair in meGO_ensemble["bond_pairs"].items():
for idx, (molecule, bond_pair) in enumerate(meGO_ensemble["bond_pairs"].items(), start=1):
if not bond_pair:
continue
reduced_topology = (
Expand Down Expand Up @@ -604,6 +604,10 @@ def generate_14_data(meGO_ensemble):
tmp["ai"], tmp["aj"] = tmp["aj"], tmp["ai"]
pairs = pd.concat([pairs, tmp], axis=0, sort=False, ignore_index=True)

mol_ai = f"{idx}_{molecule}"
pairs["molecule_name_ai"] = mol_ai
pairs["molecule_name_aj"] = mol_ai

if not pairs.empty:
pairs14 = pd.concat([pairs14, pairs], axis=0, sort=False, ignore_index=True)

Expand Down Expand Up @@ -1220,6 +1224,9 @@ def generate_LJ(meGO_ensemble, train_dataset, basic_LJ, parameters):
# rename the columns _x
meGO_LJ_14.columns = meGO_LJ_14.columns.str.rstrip("_x")

# remove intermolecular interactions across molecules from meGO_LJ_14
meGO_LJ_14 = meGO_LJ_14[meGO_LJ_14["molecule_name_ai"] == meGO_LJ_14["molecule_name_aj"]]

# copy 1-4 interactions into meGO_LJ_14
copy14 = meGO_LJ.loc[(meGO_LJ["1-4"] == "1_4")]
meGO_LJ_14 = pd.concat([meGO_LJ_14, copy14], axis=0, sort=False, ignore_index=True)
Expand Down Expand Up @@ -1367,7 +1374,7 @@ def make_pairs_exclusion_topology(meGO_ensemble, meGO_LJ_14):
Contains the "write out"-ready pairs-exclusions interactions for each molecule
"""
pairs_molecule_dict = {}
for molecule, bond_pair in meGO_ensemble["bond_pairs"].items():
for idx, (molecule, bond_pair) in enumerate(meGO_ensemble["bond_pairs"].items(), start=1):
reduced_topology = (
meGO_ensemble["topology_dataframe"]
.loc[meGO_ensemble["topology_dataframe"]["molecule_name"] == molecule][
Expand All @@ -1394,8 +1401,9 @@ def make_pairs_exclusion_topology(meGO_ensemble, meGO_LJ_14):
exclusion_bonds, p14 = topology.get_14_interaction_list(reduced_topology, bond_pair)
pairs = pd.DataFrame()
if not meGO_LJ_14.empty:
mol_ai = f"{idx}_{molecule}"
# pairs do not have duplicates because these have been cleaned before
pairs = meGO_LJ_14[
pairs = meGO_LJ_14[meGO_LJ_14["molecule_name_ai"] == mol_ai][
[
"ai",
"aj",
Expand Down
8 changes: 8 additions & 0 deletions test/run_make_mat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ tar -zxf test_inputs/make_mat_popc/hh.tgz -C test_inputs/make_mat_popc/
python ../tools/make_mat/make_mat.py --histo test_inputs/make_mat_popc/histo --target_top test_inputs/make_mat_popc/topol_md.top --mego_top test_inputs/make_mat_popc/topol_ref.top --cutoff 0.75 --mode intra --out test_inputs/make_mat_popc/
diff <(gzip -dc test_inputs/make_mat_popc/intramat_1_1.ndx.gz) <(gzip -dc test_outputs/make_mat_popc/intramat_1_1.ndx.gz)

tar -zxf test_inputs/make_mat_het_trim/hh.tgz -C test_inputs/make_mat_het_trim/
python ../tools/make_mat/make_mat.py --histo test_inputs/make_mat_het_trim/histo --target_top test_inputs/make_mat_het_trim/topol_mego.top --mego_top test_inputs/make_mat_het_trim/topol.top --cutoff 0.75 --out test_inputs/make_mat_het_trim/
diff <(gzip -dc test_inputs/make_mat_het_trim/intramat_1_1.ndx.gz) <(gzip -dc test_outputs/make_mat_het_trim/intramat_1_1.ndx.gz)
diff <(gzip -dc test_inputs/make_mat_het_trim/intramat_2_2.ndx.gz) <(gzip -dc test_outputs/make_mat_het_trim/intramat_2_2.ndx.gz)
diff <(gzip -dc test_inputs/make_mat_het_trim/intramat_3_3.ndx.gz) <(gzip -dc test_outputs/make_mat_het_trim/intramat_3_3.ndx.gz)
diff <(gzip -dc test_inputs/make_mat_het_trim/intermat_1_2.ndx.gz) <(gzip -dc test_outputs/make_mat_het_trim/intermat_1_2.ndx.gz)
diff <(gzip -dc test_inputs/make_mat_het_trim/intermat_1_3.ndx.gz) <(gzip -dc test_outputs/make_mat_het_trim/intermat_1_3.ndx.gz)
diff <(gzip -dc test_inputs/make_mat_het_trim/intermat_2_3.ndx.gz) <(gzip -dc test_outputs/make_mat_het_trim/intermat_2_3.ndx.gz)
2 changes: 2 additions & 0 deletions test/test_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
--config TEST_ROOT/test_inputs/ttrref/config.yml --explicit_name case # --system ttrref --egos production
--config TEST_ROOT/test_inputs/lyso-bnz_ref/config_1.yml --explicit_name case # --system lyso-bnz_ref --egos production
--config TEST_ROOT/test_inputs/lyso-bnz_ref/config_2.yml --explicit_name case # --system lyso-bnz_ref --egos production
--system het_trim --egos rc --no_header --explicit_name case
--system het_trim --egos production --epsilon 0.3 --train train --no_header --explicit_name case
Loading

0 comments on commit f3efb0c

Please sign in to comment.