|
24 | 24 | from espressomd.io.writer import vtf |
25 | 25 | import pyMBE |
26 | 26 | from pyMBE.lib.analysis import built_output_name |
27 | | -from pyMBE.lib.handy_functions import do_reaction |
| 27 | +from pyMBE.lib.handy_functions import do_reaction, define_peptide_AA_residues |
28 | 28 |
|
29 | 29 | # Create an instance of pyMBE library |
30 | 30 | pmb = pyMBE.pymbe_library(seed=42) |
|
95 | 95 | # Note that this parameterization only includes some of the natural aminoacids |
96 | 96 | # For the other aminoacids the user needs to use a parametrization including all the aminoacids in the peptide sequence |
97 | 97 | path_to_pka=pmb.root / "parameters" / "pka_sets" / "Hass2015.json" |
98 | | -path_to_interactions=pmb.root / "parameters" / "peptides" / "Lunkad2021.json" |
99 | | - |
100 | | -pmb.load_interaction_parameters(filename=path_to_interactions) |
| 98 | +path_to_interactions=pmb.root / "parameters" / "peptides" / "Lunkad2021" |
| 99 | + |
| 100 | +pmb.load_database(folder=path_to_interactions) |
| 101 | +# define templates for the c and n ends |
| 102 | +pmb.define_particle(name="n", |
| 103 | + sigma=1*pmb.units.reduced_length, |
| 104 | + epsilon=1*pmb.units.reduced_energy, |
| 105 | + acidity="basic") |
| 106 | +pmb.define_particle(name="c", |
| 107 | + sigma=1*pmb.units.reduced_length, |
| 108 | + epsilon=1*pmb.units.reduced_energy, |
| 109 | + acidity="acidic") |
101 | 110 | pmb.load_pka_set(path_to_pka) |
102 | 111 |
|
| 112 | +# Define acid/base particle states |
| 113 | +pka_set = pmb.get_pka_set() |
| 114 | +for particle_name in pka_set.keys(): |
| 115 | + if particle_name not in ["c", "n"]: # Avoid redefing the ends |
| 116 | + pmb.define_monoprototic_particle_states(particle_name=particle_name, |
| 117 | + acidity=pka_set[particle_name]["acidity"]) |
| 118 | + |
103 | 119 | # Defines the bonds |
104 | 120 | bond_type = 'harmonic' |
105 | 121 | generic_bond_length=0.4 * pmb.units.nm |
|
120 | 136 | pmb.define_peptide (name=peptide2, |
121 | 137 | sequence=sequence2, |
122 | 138 | model=model) |
| 139 | +define_peptide_AA_residues(sequence=sequence1, |
| 140 | + model=model, |
| 141 | + pmb=pmb) |
| 142 | +define_peptide_AA_residues(sequence=sequence2, |
| 143 | + model=model, |
| 144 | + pmb=pmb) |
123 | 145 |
|
124 | 146 | # Solution parameters |
125 | 147 | c_salt=5e-3 * pmb.units.mol/ pmb.units.L |
|
212 | 234 | vtf.writevsf(espresso_system, coordinates) |
213 | 235 | vtf.writevcf(espresso_system, coordinates) |
214 | 236 |
|
215 | | -#List of ionisable groups |
216 | | -basic_groups = pmb.df.loc[(~pmb.df['particle_id'].isna()) & (pmb.df['acidity']=='basic')].name.to_list() |
217 | | -acidic_groups = pmb.df.loc[(~pmb.df['particle_id'].isna()) & (pmb.df['acidity']=='acidic')].name.to_list() |
218 | | -list_ionisable_groups = basic_groups + acidic_groups |
219 | | -total_ionisable_groups = len (list_ionisable_groups) |
| 237 | +# count acid/base particles |
| 238 | +pka_set = pmb.get_pka_set() |
| 239 | +acid_base_ids = [] |
| 240 | +for name in pka_set.keys(): |
| 241 | + acid_base_ids+=pmb.db.find_instance_ids_by_name(pmb_type="particle", |
| 242 | + name=name) |
| 243 | +total_ionisable_groups = len(acid_base_ids) |
| 244 | + |
220 | 245 | # Get peptide net charge |
221 | 246 | if verbose: |
222 | 247 | print("The box length of your system is", L.to('reduced_length'), L.to('nm')) |
223 | 248 |
|
224 | 249 | if args.mode == 'standard': |
225 | | - grxmc, sucessful_reactions_labels, ionic_strength_res = pmb.setup_grxmc_reactions(pH_res=pH_value, |
226 | | - c_salt_res=c_salt, |
227 | | - proton_name=proton_name, |
228 | | - hydroxide_name=hydroxide_name, |
229 | | - salt_cation_name=sodium_name, |
230 | | - salt_anion_name=chloride_name, |
231 | | - activity_coefficient=lambda x: 1.0) |
| 250 | + grxmc, ionic_strength_res = pmb.setup_grxmc_reactions(pH_res=pH_value, |
| 251 | + c_salt_res=c_salt, |
| 252 | + proton_name=proton_name, |
| 253 | + hydroxide_name=hydroxide_name, |
| 254 | + salt_cation_name=sodium_name, |
| 255 | + salt_anion_name=chloride_name, |
| 256 | + activity_coefficient=lambda x: 1.0) |
232 | 257 | elif args.mode == 'unified': |
233 | | - grxmc, sucessful_reactions_labels, ionic_strength_res = pmb.setup_grxmc_unified(pH_res=pH_value, |
234 | | - c_salt_res=c_salt, |
235 | | - cation_name=cation_name, |
236 | | - anion_name=anion_name, |
237 | | - activity_coefficient=lambda x: 1.0) |
| 258 | + grxmc, ionic_strength_res = pmb.setup_grxmc_unified(pH_res=pH_value, |
| 259 | + c_salt_res=c_salt, |
| 260 | + cation_name=cation_name, |
| 261 | + anion_name=anion_name, |
| 262 | + activity_coefficient=lambda x: 1.0) |
238 | 263 | if verbose: |
239 | | - print('The acid-base reaction has been sucessfully setup for ', sucessful_reactions_labels) |
| 264 | + print("The acid-base reaction has been successfully set up for:") |
| 265 | + print(pmb.get_reactions_df()) |
240 | 266 |
|
241 | 267 | # Setup espresso to track the ionization of the acid/basic groups in peptide |
242 | 268 | type_map =pmb.get_type_map() |
|
0 commit comments