Skip to content

Commit

Permalink
cleaned rc and updated regtests
Browse files Browse the repository at this point in the history
  • Loading branch information
carlocamilloni committed Dec 7, 2024
1 parent 32239b4 commit ae27191
Show file tree
Hide file tree
Showing 28 changed files with 193,568 additions and 223,631 deletions.
8 changes: 0 additions & 8 deletions multiego.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,6 @@ def main():
elapsed_time = et - st
st = et
print("- Done in:", elapsed_time, "seconds")
else:
print("- Generate the LJ dataset")
meGO_LJ = ensemble.generate_OO_LJ(meGO_ensembles)
meGO_LJ_14 = pairs14
et = time.time()
elapsed_time = et - st
st = et
print("- Done in:", elapsed_time, "seconds")

print("- Finalize pairs and exclusions")
meGO_LJ_14 = ensemble.make_pairs_exclusion_topology(meGO_ensembles, meGO_LJ_14, args)
Expand Down
11 changes: 2 additions & 9 deletions src/multiego/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
},
"--egos": {
"type": str,
"choices": ["rc", "mg", "production"],
"help": "rc: creates a force-field for random coil simulations. "
"mg: creates a force-field for molten globule simulations."
"choices": ["mg", "production"],
"help": "mg: creates a force-field for molten globule simulations."
"production: creates a force-field combining random coil simulations and training simulations.",
},
"--reference": {
Expand Down Expand Up @@ -120,12 +119,6 @@
"type": str,
"help": "Explicit name for the output directory stored in outputs/system",
},
"--regtest": {
"type": bool,
"default": False,
"action": "store_true",
"help": "Use old rules for regtests check.",
},
"--config": {
"default": "",
"type": str,
Expand Down
43 changes: 17 additions & 26 deletions src/multiego/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,32 +1200,23 @@ def generate_LJ(meGO_ensemble, train_dataset, parameters):
# now we can remove contacts with default c6/c12 becasue these
# are uninformative and predefined. This also allow to replace them with contact learned
# by either intra/inter training. We cannot remove 1-4 interactions.
if not parameters.regtest:
meGO_LJ = meGO_LJ.loc[
~(
(meGO_LJ["epsilon"] > 0)
& (meGO_LJ["mg_epsilon"] > 0)
& ((abs(meGO_LJ["epsilon"] - meGO_LJ["mg_epsilon"]) / meGO_LJ["mg_epsilon"]) < parameters.relative_c12d)
& ((abs(meGO_LJ["sigma"] - meGO_LJ["mg_sigma"]) / meGO_LJ["mg_sigma"]) < parameters.relative_c12d)
& (meGO_LJ["1-4"] == "1>4")
)
]
meGO_LJ = meGO_LJ.loc[
~(
(meGO_LJ["epsilon"] < 0)
& (meGO_LJ["mg_epsilon"] < 0)
& ((abs(meGO_LJ["epsilon"] - meGO_LJ["mg_epsilon"]) / abs(meGO_LJ["mg_epsilon"])) < parameters.relative_c12d)
& (meGO_LJ["1-4"] == "1>4")
)
]
else:
meGO_LJ = meGO_LJ.loc[
~(
(meGO_LJ["epsilon"] < 0)
& ((abs(-meGO_LJ["epsilon"] - meGO_LJ["rep"]) / meGO_LJ["rep"]) < parameters.relative_c12d)
& (meGO_LJ["1-4"] == "1>4")
)
]
meGO_LJ = meGO_LJ.loc[
~(
(meGO_LJ["epsilon"] > 0)
& (meGO_LJ["mg_epsilon"] > 0)
& ((abs(meGO_LJ["epsilon"] - meGO_LJ["mg_epsilon"]) / meGO_LJ["mg_epsilon"]) < parameters.relative_c12d)
& ((abs(meGO_LJ["sigma"] - meGO_LJ["mg_sigma"]) / meGO_LJ["mg_sigma"]) < parameters.relative_c12d)
& (meGO_LJ["1-4"] == "1>4")
)
]
meGO_LJ = meGO_LJ.loc[
~(
(meGO_LJ["epsilon"] < 0)
& (meGO_LJ["mg_epsilon"] < 0)
& ((abs(meGO_LJ["epsilon"] - meGO_LJ["mg_epsilon"]) / abs(meGO_LJ["mg_epsilon"])) < parameters.relative_c12d)
& (meGO_LJ["1-4"] == "1>4")
)
]

# transfer rule for inter/intra contacts:
# 1) only attractive contacts can be transferd
Expand Down
9 changes: 3 additions & 6 deletions src/multiego/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,7 @@ def write_nonbonded(topology_dataframe, meGO_LJ, parameters, output_folder):
file.write(" 1 1 no 1.0 1.0\n\n")

file.write("[ atomtypes ]\n")
if parameters.egos == "rc":
atomtypes = topology_dataframe[["sb_type", "atomic_number", "mass", "charge", "ptype", "rc_c6", "rc_c12"]].copy()
atomtypes.rename(columns={"rc_c6": "c6", "rc_c12": "c12"}, inplace=True)
elif parameters.egos == "mg":
if parameters.egos == "mg":
atomtypes = topology_dataframe[["sb_type", "atomic_number", "mass", "charge", "ptype", "mg_c6", "mg_c12"]].copy()
atomtypes.rename(columns={"mg_c6": "c6", "mg_c12": "c12"}, inplace=True)
else:
Expand Down Expand Up @@ -728,7 +725,7 @@ def get_name(parameters):
name : str
The name of the output directory
"""
if parameters.egos == "rc":
if parameters.egos == "mg":
name = f"{parameters.system}_{parameters.egos}"
else:
name = f"{parameters.system}_{parameters.egos}_epsis_intra{ '-'.join(np.array(parameters.multi_epsilon, dtype=str)) }_{parameters.inter_epsilon}"
Expand Down Expand Up @@ -795,7 +792,7 @@ def check_files_existence(args):
ndx_files = glob.glob(f"{ensemble}/*.ndx")
ndx_files += glob.glob(f"{ensemble}/*.ndx.gz")
ndx_files += glob.glob(f"{ensemble}/*.h5")
if not ndx_files and not args.egos == "rc":
if not ndx_files and not args.egos == "mg":
raise FileNotFoundError(
f"contact matrix input file(s) (e.g., intramat_1_1.ndx, etc.) were not found in {ensemble}/"
)
Expand Down
16 changes: 8 additions & 8 deletions test/test_cases.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
--system gpref --egos rc --no_header --regtest --explicit_name case
--system gpref --egos production --epsilon 0.235 --train md_ensemble --single_molecule --no_header --regtest --explicit_name case
--config TEST_ROOT/test_inputs/abetaref/config.yml --regtest --explicit_name case # --system abetaref --egos production
--config TEST_ROOT/test_inputs/ttrref/config.yml --regtest --explicit_name case # --system ttrref --egos production
--config TEST_ROOT/test_inputs/lyso-bnz_ref/config_1.yml --regtest --explicit_name case # --system lyso-bnz_ref --egos production
--config TEST_ROOT/test_inputs/lyso-bnz_ref/config_2.yml --regtest --explicit_name case # --system lyso-bnz_ref --egos production
--system het_trim --egos rc --no_header --regtest --explicit_name case
--system het_trim --egos production --epsilon 0.3 --train train --no_header --regtest --explicit_name case
--system gpref --egos mg --no_header --explicit_name case
--system gpref --egos production --epsilon 0.235 --train md_ensemble --single_molecule --no_header --explicit_name case
--config TEST_ROOT/test_inputs/abetaref/config.yml --explicit_name case # --system abetaref --egos production
--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 mg --no_header --explicit_name case
--system het_trim --egos production --epsilon 0.3 --train train --no_header --explicit_name case
4 changes: 2 additions & 2 deletions test/test_inputs/abetaref/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- system: abetaref
- egos: production
- epsilon: 0.33
- epsilon: 0.24
- train: native_MD
- reference: ref
- single_molecule
Expand All @@ -16,4 +16,4 @@
- TYR CE1 CE2
- VAL CG1 CG2
- ALA O1 O2
- no_header
- no_header
Loading

0 comments on commit ae27191

Please sign in to comment.