Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 8 additions & 8 deletions multi-ego-basic.ff/aminoacids.rtp
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,11 @@
[ dihedrals ]
; ai aj ak al gromos type
-CA -C N CA gd_14
-C N CA C gd_44QK
-C N CA C gd_43QK
-C N CA C gd_44Q
-C N CA C gd_43Q
N CA CB CG gd_34
N CA C +N gd_45QK
N CA C +N gd_42QK
N CA C +N gd_45Q
N CA C +N gd_42Q
CA CB CG CD gd_34
CB CG CD NE2 gd_40

Expand Down Expand Up @@ -707,11 +707,11 @@
[ dihedrals ]
; ai aj ak al gromos type
-CA -C N CA gd_14
-C N CA C gd_44QK
-C N CA C gd_43QK
-C N CA C gd_44K
-C N CA C gd_43K
N CA CB CG gd_34
N CA C +N gd_45QK
N CA C +N gd_42QK
N CA C +N gd_45K
N CA C +N gd_42K
CA CB CG CD gd_34
CB CG CD CE gd_34
CG CD CE NZ gd_34
Expand Down
89 changes: 52 additions & 37 deletions multi-ego-basic.ff/ffbonded.itp
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,13 @@
;;;;;;;;;;;;;;;;;;;;
;ALA
;;;;;;;;;;;;;;;;;;;;
#define gd_42A 170.0000 2.5000 2
#define gd_42A 100.0000 3.0000 2
; Backbone dihedral angle -N-CA-C-N- ALA
;
#define gd_43A 15.0000 3.300 3 ;heigher k to shift down J coupling and have a cleaner distinction between betas
; Backbone dihedral angle -C-N-CA-C- ALA
;
#define gd_44A -164.000 2.8 1
#define gd_44A 170.000 3.0 1
; Backbone dihedral angle -C-N-CA-C- ALA
;
#define gd_45A -170.00 4.0 1
Expand All @@ -391,28 +391,28 @@
;;;;;;;;;;;;;;;;;;;;
; ASN
;;;;;;;;;;;;;;;;;;;;
#define gd_42N -170.0000 2.5000 2
#define gd_42N 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- ASN
;
#define gd_43N 15.0000 1.300 3
; Backbone dihedral angle -C-N-CA-C- ASN
;
#define gd_44N -120.000 4.6 1
#define gd_44N -120.000 3.0 1
; Backbone dihedral angle -C-N-CA-C- ASN
;
#define gd_45N 180.00 2.3 1
#define gd_45N 180.00 1.0 1
; Backbone dihedral angle -N-CA-C-N- ASN
;
;;;;;;;;;;;;;;;;;;;;
; ASP
;;;;;;;;;;;;;;;;;;;;
#define gd_42D 170.0000 2.5000 2
#define gd_42D 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- ASP
;
#define gd_43D 15.0000 2.000 3
; Backbone dihedral angle -C-N-CA-C- ASPl
;
#define gd_44D -140.000 3.60 1
#define gd_44D 180.000 3.60 1
; Backbone dihedral angle -C-N-CA-C- ASP
;
#define gd_45D 180.00 1.6 1
Expand All @@ -421,13 +421,13 @@
;;;;;;;;;;;;;;;;;;;;
; CYS
;;;;;;;;;;;;;;;;;;;;
#define gd_42C 170.0000 2.5000 2
#define gd_42C 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- CYS
;
#define gd_43C 15.0000 1.300 3
; Backbone dihedral angle -C-N-CA-C- CYS
;
#define gd_44C -140.000 4.00 1
#define gd_44C 180.000 4.00 1
; Backbone dihedral angle -C-N-CA-C- CYS
;
#define gd_45C 180.00 2.0 1
Expand All @@ -436,7 +436,7 @@
;;;;;;;;;;;;;;;;;;;;
;GLU
;;;;;;;;;;;;;;;;;;;;
#define gd_42E 170.0000 2.5000 2
#define gd_42E 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- GLU
;
#define gd_43E 15.0000 2.60 3 ;heigher k to shift down J coupling and have a cleaner distinction between betas
Expand All @@ -451,28 +451,28 @@
;;;;;;;;;;;;;;;;;;;;
; HIS
;;;;;;;;;;;;;;;;;;;;
#define gd_42H 170.0000 2.5000 2
#define gd_42H 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- HIS
;
#define gd_43H 15.0000 1.00 3
; Backbone dihedral angle -C-N-CA-C- HIS
;
#define gd_44H -110.000 3.70 1
#define gd_44H 180.000 3.70 1
; Backbone dihedral angle -C-N-CA-C- HIS
;
#define gd_45H 180.00 2.9 1
#define gd_45H 180.00 0.5 1
; Backbone dihedral angle -N-CA-C-N- HIS
;
;;;;;;;;;;;;;;;;;;;;
; LEU
;;;;;;;;;;;;;;;;;;;;
#define gd_42L 170.0000 2.5000 2
#define gd_42L 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- LEU
;
#define gd_43L 15.0000 1.600 3
; Backbone dihedral angle -C-N-CA-C- LEU
;
#define gd_44L -140.000 3.0 1
#define gd_44L 180.000 3.0 1
; Backbone dihedral angle -C-N-CA-C- LEU
;
#define gd_45L 180.00 1.6 1
Expand All @@ -481,13 +481,13 @@
;;;;;;;;;;;;;;;;;;;;
; MET
;;;;;;;;;;;;;;;;;;;;
#define gd_42M 170.0000 2.5000 2
#define gd_42M 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- MET
;
#define gd_43M 15.0000 2.000 3
; Backbone dihedral angle -C-N-CA-C- MET
;
#define gd_44M -130.000 3.5 1
#define gd_44M 180.000 3.5 1
; Backbone dihedral angle -C-N-CA-C- MET
;
#define gd_45M 180.00 1.8 1
Expand All @@ -496,59 +496,74 @@
;;;;;;;;;;;;;;;;;;;;
; ARG/TRP
;;;;;;;;;;;;;;;;;;;;
#define gd_42RW 170.0000 2.5000 2
#define gd_42RW 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- ARG/TRP
;
#define gd_43RW 15.0000 2.500 3
; Backbone dihedral angle -C-N-CA-C- ARG/TRP
;
#define gd_44RW -120.000 2.70 1
#define gd_44RW 180.000 2.70 1
; Backbone dihedral angle -C-N-CA-C- ARG/TRP
;
#define gd_45RW 180.000 2.50 1
; Backbone dihedral angle -N-CA-C-N- ARG/TRP
;
;
;;;;;;;;;;;;;;;;;;;;
; GLN/LYS
; GLN
;;;;;;;;;;;;;;;;;;;;
#define gd_42QK 170.0000 2.5000 2
#define gd_42Q 150.0000 1.5000 2
; Backbone dihedral angle -N-CA-C-N- GLN/LYS
;
#define gd_43QK 15.0000 2.000 3
#define gd_43Q 15.0000 2.000 3
; Backbone dihedral angle -C-N-CA-C- GLN/LYS
;
#define gd_44QK -120.000 2.80 1
#define gd_44Q -120.000 1.00 1
; Backbone dihedral angle -C-N-CA-C- GLN/LYS
;
#define gd_45QK 180.000 3.30 1
#define gd_45Q 180.000 3.00 1
; Backbone dihedral angle -N-CA-C-N- GLN/LYS
;
;;;;;;;;;;;;;;;;;;;;
; LYS
;;;;;;;;;;;;;;;;;;;;
#define gd_42K 150.0000 1.5000 2
; Backbone dihedral angle -N-CA-C-N- GLN/LYS
;
#define gd_43K 15.0000 2.000 3
; Backbone dihedral angle -C-N-CA-C- GLN/LYS
;
#define gd_44K -120.000 1.00 1
; Backbone dihedral angle -C-N-CA-C- GLN/LYS
;
#define gd_45K 180.000 0.00 1
; Backbone dihedral angle -N-CA-C-N- GLN/LYS
;
;;;;;;;;;;;;;;;;;;;;
; VAL/ILE
;;;;;;;;;;;;;;;;;;;;
#define gd_42VI 170.0000 2.0000 2
#define gd_42VI 150.0000 0.0000 2
; Backbone dihedral angle -N-CA-C-N- VAL/ILE
;
#define gd_43VI 15.0000 1.800 3 ; lower k for higher J coupling and more population in intermediate beta region
#define gd_43VI 15.0000 1.000 3 ; lower k for higher J coupling and more population in intermediate beta region
; Backbone dihedral angle -C-N-CA-C- VAL/ILE
;
#define gd_44VI -97.000 3.9 1
; Backbone dihedral angle -C-N-CA-C- VAL/ILE
;
#define gd_45VI 180.00 1.2 1
#define gd_45VI 180.00 0.0 1
; Backbone dihedral angle -N-CA-C-N- VAL/ILE

;;;;;;;;;;;;;;;;;;;;
; PHE
;;;;;;;;;;;;;;;;;;;;
#define gd_42F 170.0000 2.5000 2
#define gd_42F 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- PHE
;
#define gd_43F 15.0000 1.700 3
; Backbone dihedral angle -C-N-CA-C- PHE
;
#define gd_44F -110.000 3.3 1
#define gd_44F 180.000 3.3 1
; Backbone dihedral angle -C-N-CA-C- PHE
;
#define gd_45F 180.00 2.1 1
Expand All @@ -557,22 +572,22 @@
;;;;;;;;;;;;;;;;;;;;
;SER
;;;;;;;;;;;;;;;;;;;;
#define gd_42S 170.0000 2.5000 2
#define gd_42S 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- SER
;
#define gd_43S 15.0000 2.500 3
; Backbone dihedral angle -C-N-CA-C- SER
;
#define gd_44S -140.000 2.80 1
#define gd_44S -140.000 1.50 1
; Backbone dihedral angle -C-N-CA-C- SER
;
#define gd_45S 180.00 2.90 1
#define gd_45S 180.00 0.00 1
; Backbone dihedral angle -N-CA-C-N- SER
;
;;;;;;;;;;;;;;;;;;;;
;THR
;;;;;;;;;;;;;;;;;;;;
#define gd_42T 170.0000 2.5000 2
#define gd_42T 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- THR
;
#define gd_43T 15.0000 2.50 3
Expand All @@ -581,22 +596,22 @@
#define gd_44T -95.000 3.3 1
; Backbone dihedral angle -C-N-CA-C- THR
;
#define gd_45T 180.00 2.2 1
#define gd_45T 180.00 0.0 1
; Backbone dihedral angle -N-CA-C-N- THR
;
;;;;;;;;;;;;;;;;;;;;
; TYR
;;;;;;;;;;;;;;;;;;;;
#define gd_42Y 170.0000 2.5000 2
#define gd_42Y 150.0000 2.5000 2
; Backbone dihedral angle -N-CA-C-N- TYR
;
#define gd_43Y 15.0000 2.000 3
; Backbone dihedral angle -C-N-CA-C- TYR
;
#define gd_44Y -110.000 2.9 1
#define gd_44Y -110.000 2.0 1
; Backbone dihedral angle -C-N-CA-C- TYR
;
#define gd_45Y 180.00 1.8 1
#define gd_45Y 180.00 0.0 1
; Backbone dihedral angle -N-CA-C-N- TYR
;

Expand Down
35 changes: 20 additions & 15 deletions src/multiego/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ def generate_MG_LJ_pairs_rep(sbtype1, sbtype2, dictionary_name_rc_c12, c12_rep=N
pairs_LJ["c12"] = c12_rep / factor
pairs_LJ["c6"] = 0.0
pairs_LJ["epsilon"] = -c12_rep / factor
pairs_LJ["sigma"] = c12_rep / factor ** (1.0 / 12.0) / 2.0 ** (1.0 / 6.0)
pairs_LJ["sigma"] = (c12_rep / factor) ** (1.0 / 12.0) / 2.0 ** (1.0 / 6.0)
pairs_LJ["mg_sigma"] = pairs_LJ["sigma"]
pairs_LJ["mg_epsilon"] = -c12_rep / factor

Expand Down Expand Up @@ -1047,11 +1047,16 @@ def set_sig_epsilon(meGO_LJ, parameters):
# this is used only when MD_th < MD_p < limit_rc_att*RC_p
# negative epsilon are used to identify non-attractive interactions
condition = (
meGO_LJ["probability"] <= meGO_LJ["limit_rc_att"] * np.maximum(meGO_LJ["rc_probability"], meGO_LJ["rc_threshold"])
) & (meGO_LJ["probability"] > meGO_LJ["md_threshold"])
meGO_LJ.loc[condition, "epsilon"] = -meGO_LJ["rep"] * (
1.0 + (np.maximum(meGO_LJ["rc_probability"], meGO_LJ["rc_threshold"]) - meGO_LJ["probability"])
(meGO_LJ["probability"] <= meGO_LJ["limit_rc_att"] * np.maximum(meGO_LJ["rc_probability"], meGO_LJ["rc_threshold"]))
& (meGO_LJ["probability"] > meGO_LJ["md_threshold"])
& (meGO_LJ["rc_probability"] > meGO_LJ["md_threshold"])
)
# meGO_LJ.loc[condition, "epsilon"] = -meGO_LJ["rep"] * (
# 1.0 + (np.maximum(meGO_LJ["rc_probability"], meGO_LJ["rc_threshold"]) - meGO_LJ["probability"])
# )
meGO_LJ.loc[condition, "epsilon"] = (-meGO_LJ["rep"] * (meGO_LJ["distance"] / meGO_LJ["rc_distance"]) ** 12).clip(
lower=-20 * meGO_LJ["rep"], upper=-0.05 * meGO_LJ["rep"]
)[condition]
meGO_LJ.loc[condition, "learned"] = 1

# 1-4 interactions are special and cannot become attractive because they are part of the bonded-interactions
Expand Down Expand Up @@ -1250,7 +1255,7 @@ def generate_LJ(meGO_ensemble, train_dataset, parameters):
& (meGO_LJ["mg_epsilon"] < 0)
& ((abs(meGO_LJ["epsilon"] - meGO_LJ["mg_epsilon"]) / abs(meGO_LJ["mg_epsilon"])) < parameters.relative_c12d)
& ((meGO_LJ["bond_distance"] > 3) | (~meGO_LJ["same_chain"]))
& ~((meGO_LJ["bond_distance"] < 7) & (meGO_LJ["same_chain"]))
& ~((meGO_LJ["bond_distance"] < 6) & (meGO_LJ["same_chain"]))
)
]

Expand Down Expand Up @@ -1291,10 +1296,10 @@ def generate_LJ(meGO_ensemble, train_dataset, parameters):

if not parameters.single_molecule:
# neighbour intramolecular interactions are not used as intermolecular
copy_intra = meGO_LJ.loc[(meGO_LJ["same_chain"]) & (meGO_LJ["bond_distance"] < 7)]
copy_intra = meGO_LJ.loc[(meGO_LJ["same_chain"]) & (meGO_LJ["bond_distance"] < 6)]
meGO_LJ_14 = pd.concat([meGO_LJ_14, copy_intra], axis=0, sort=False, ignore_index=True)
# remove them from the default force-field
meGO_LJ = meGO_LJ.loc[~((meGO_LJ["same_chain"]) & (meGO_LJ["bond_distance"] < 7))]
meGO_LJ = meGO_LJ.loc[~((meGO_LJ["same_chain"]) & (meGO_LJ["bond_distance"] < 6))]

# now we can decide to keep intermolecular interactions as intramolecular ones
# to do this is enough to remove it from meGO_LJ_14, in this way the value used for the contact is the one meGO_LJ
Expand All @@ -1305,7 +1310,7 @@ def generate_LJ(meGO_ensemble, train_dataset, parameters):
(~meGO_LJ_14["same_chain"])
& (meGO_LJ_14["molecule_name_ai"] == meGO_LJ_14["molecule_name_aj"])
& (meGO_LJ_14["epsilon"] > 0.0)
& (meGO_LJ_14["bond_distance"] > 6)
& (meGO_LJ_14["bond_distance"] > 5)
)
]
else:
Expand Down Expand Up @@ -1650,30 +1655,30 @@ def make_pairs_exclusion_topology(meGO_ensemble, meGO_LJ_14, args):
# this need to be the default repulsion if within two residue
if not pairs.empty:
pairs.loc[
(~pairs["same_chain"]) & (pairs["bond_distance"] < 7),
(~pairs["same_chain"]) & (pairs["bond_distance"] < 6),
"c6",
] = 0.0
pairs.loc[
(~pairs["same_chain"]) & (pairs["bond_distance"] < 7),
(~pairs["same_chain"]) & (pairs["bond_distance"] < 6),
"c12",
] = pairs["rep"]
# else it should be default mg
pairs.loc[
(~pairs["same_chain"]) & (pairs["bond_distance"] > 6) & (pairs["mg_epsilon"] < 0.0),
(~pairs["same_chain"]) & (pairs["bond_distance"] > 5) & (pairs["mg_epsilon"] < 0.0),
"c6",
] = 0.0
pairs.loc[
(~pairs["same_chain"]) & (pairs["bond_distance"] > 6) & (pairs["mg_epsilon"] < 0.0),
(~pairs["same_chain"]) & (pairs["bond_distance"] > 5) & (pairs["mg_epsilon"] < 0.0),
"c12",
] = -pairs["mg_epsilon"]
pairs.loc[
(~pairs["same_chain"]) & (pairs["bond_distance"] > 6) & (pairs["mg_epsilon"] > 0.0),
(~pairs["same_chain"]) & (pairs["bond_distance"] > 5) & (pairs["mg_epsilon"] > 0.0),
"c6",
] = (
4 * pairs["mg_epsilon"] * (pairs["mg_sigma"] ** 6)
)
pairs.loc[
(~pairs["same_chain"]) & (pairs["bond_distance"] > 6) & (pairs["mg_epsilon"] > 0.0),
(~pairs["same_chain"]) & (pairs["bond_distance"] > 5) & (pairs["mg_epsilon"] > 0.0),
"c12",
] = (
4 * pairs["mg_epsilon"] * (pairs["mg_sigma"] ** 12)
Expand Down
Loading
Loading