Skip to content

Commit

Permalink
reorga
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlyEmpereurmot committed Jun 6, 2023
1 parent 73a2016 commit c4e5b8f
Show file tree
Hide file tree
Showing 22 changed files with 38 additions and 42 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The parameters of the CG lipid models are iteratively and simultaneously optimiz

![Overview of the principles used in SwarmCG for model and force field building](https://github.com/GMPavanLab/SwarmCGM/blob/main/images/Fig1.png)

This code was recently applied as part of the efforts deployed for the further enhancement of lipid models in Martini 3. Proof-of-concept and testing of different CG resolutions for building alternative Martini lipid models is soon to be published in JCIM and a [preprint version is available on ChemRxiv](chemrxiv.org/engage/chemrxiv/article-details/642e9c97736114c96301544d). Resulting models obtained for phosphatidylcholine (PC) lipids are [available here](github.com/GMPavanLab/SwarmCGM/tree/main/resulting_models/).
This code was recently applied as part of efforts for the further enhancement of lipid models in Martini 3. Proof-of-concept and testing of different CG resolutions for building alternative Martini lipid models is soon to be published in JCIM and a [preprint version is available on ChemRxiv](chemrxiv.org/engage/chemrxiv/article-details/642e9c97736114c96301544d). Resulting models obtained for phosphatidylcholine (PC) lipids are [available here](https://github.com/GMPavanLab/SwarmCGM/tree/main/resulting_models/).

# System Requirements

Expand Down Expand Up @@ -54,15 +54,15 @@ Supported HPC resource managers:

# Installation Guide

Standalone files can be directly copied as [provided here](github.com/GMPavanLab/SwarmCGM/tree/main/).
Standalone files can be directly copied as [provided here](https://github.com/GMPavanLab/SwarmCGM/tree/main/).

Users must install the following python packages prior to executing the code:

```
pip/pip3 install numpy scipy matplotlib MDAnalysis pyemd fst-pso pyyaml
```

If you are having troubles installing or using this software, please [drop us an Issue](github.com/GMPavanLab/SwarmCGM/issues).
If you are having troubles installing or using this software, please [drop us an Issue](https://github.com/GMPavanLab/SwarmCGM/issues).

Tested python & package versions:
- python: 3.6.12, 3.8.5
Expand Down Expand Up @@ -97,7 +97,7 @@ These values can be even further decreased for the purpose of testing the consis
As the input of SwarmCG requires a preliminary CG mapping choice (*i.e.* defining the positions and types of the CG beads, bonds and angles used for building the molecular models which parameters will be optimized), several parameters allow to define precisely which parameters should be optimized, or which other ones stay at given fixed values, according to your requirements.
To this end, SwarmCG makes use of [YAML](yaml.org) config files to simplify this process and help keeping track of the hyper-parameters used for an optimization run.

Please refer to [the demo YAML config file](github.com/GMPavanLab/SwarmCGM/tree/main/minimalistic_demo.yaml) for a breakdown of each parameter and step-by-step guidance on how to parametrize an optimization procedure.
Please refer to [the demo YAML config file](https://github.com/GMPavanLab/SwarmCGM/tree/main/minimalistic_demo.yaml) for a breakdown of each parameter and step-by-step guidance on how to parametrize an optimization procedure.
These parameters can also be related to the content and explanations provided in the paper.

# Citation
Expand Down
Binary file modified images/Fig1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 31 additions & 36 deletions minimalistic_demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lipids_codes: # lipids and temperatures to use for this optimization (other inp
POPC: [303K]
DOPC: [303K]
map_center: COG # COG or COM, for using Center Of Geometry or Center Of Mass when reading the NDX files and getting the AA-mapped bottom-up ref. data
reset: True # if True, recalculates bond and angle distributions and distance distributions between pair of beads from the AA data
reset: True # if True, recalculates bond and angle distributions and distance distributions between pair of beads from the AA data, otherwise, they are saved as a pickle and will be re-used
phosphate_pos: # position of the phosphate atom or bead, used for calculating Dhh membrane thickness
PC: # per head type
AA: 20 # atom id of the phosphate, 1-indexed
Expand Down Expand Up @@ -72,32 +72,32 @@ gpu_ids: "X X" # string, space-separated GPU ids to use per simulation slot def
gmx_gpu_cancel_str: "-nb cpu" # string, will be added to GROMACS commands for the slots which have disabled GPU usage (= marked 'X' in 'gpu_ids')

# 9. INITIAL FORCE FIELD PARAMETERS FOR BONDED TERMS
init_bonded: # must correspond to bond and angle types as defined in your input ITP files
B1: { val: 0, fct: 1250 } # Bonds
B2: { val: 0, fct: 1250 } # nm, kJ.mol-1.nm-2
B3: { val: 0, fct: 1250 }
B4: { val: 0, fct: 1250 }
B5: { val: 0, fct: 1250 }
B6: { val: 0, fct: 1250 }
B7: { val: 0, fct: 1250 }
B8: { val: 0, fct: 1250 }
B10: { val: 0, fct: 1250 }
B11: { val: 0, fct: 1250 }
A1: { val: 0, fct: 50 } # Angles
A2: { val: 0, fct: 50 } # degrees, kJ.mol-1
A3: { val: 0, fct: 50 }
A4: { val: 0, fct: 50 }
A5: { val: 0, fct: 50 }
A6: { val: 0, fct: 50 }
A7: { val: 0, fct: 50 }
A8: { val: 0, fct: 50 }
A9: { val: 0, fct: 50 }
A10: { val: 0, fct: 50 }
A11: { val: 0, fct: 50 }
A12: { val: 0, fct: 50 }
A13: { val: 0, fct: 50 }
A14: { val: 0, fct: 50 }
A15: { val: 0, fct: 50 }
config_bonded_opti: # must correspond to bond and angle types as defined in your input ITP files
B1: { start: { val: 0.5, fct: 1250 }, swarm_init: { val: [0, 1], fct: [500, 2500] }, boundaries: { val: [0, 1.5], fct: [0, 5000]}} # Bonds
B2: { start: { val: 0.5, fct: 1250 }, swarm_init: { val: [0, 1], fct: [500, 2500] }, boundaries: { val: [0, 1.5], fct: [0, 5000]} } # nm, kJ.mol-1.nm-2
B3: { start: { val: 0.5, fct: 1250 }, swarm_init: { val: [0, 1], fct: [500, 2500] }, boundaries: { val: [0, 1.5], fct: [0, 5000]} }
B4: { start: { val: 0.5, fct: 1250 }, swarm_init: { val: [0, 1], fct: [500, 2500] }, boundaries: { val: [0, 1.5], fct: [0, 5000]} }
B5: { start: { val: 0.5, fct: 1250 }, swarm_init: { val: [0, 1], fct: [500, 2500] }, boundaries: { val: [0, 1.5], fct: [0, 5000]} }
B6: { start: { val: 0.5, fct: 1250 }, swarm_init: { val: [0, 1], fct: [500, 2500] }, boundaries: { val: [0, 1.5], fct: [0, 5000]} }
B7: { start: { val: 0.5, fct: 1250 }, swarm_init: { val: [0, 1], fct: [500, 2500] }, boundaries: { val: [0, 1.5], fct: [0, 5000]} }
B8: { start: { val: 0.5, fct: 1250 }, swarm_init: { val: [0, 1], fct: [500, 2500] }, boundaries: { val: [0, 1.5], fct: [0, 5000]} }
B10: { start: { val: 0.5, fct: 1250 }, swarm_init: { val: [0, 1], fct: [500, 2500] }, boundaries: { val: [0, 1.5], fct: [0, 5000]} }
B11: { start: { val: 0.5, fct: 1250 }, swarm_init: { val: [0, 1], fct: [500, 2500] }, boundaries: { val: [0, 1.5], fct: [0, 5000]} }
A1: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} } # Angles
A2: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} } # degrees, kJ.mol-1
A3: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A4: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A5: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A6: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A7: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A8: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A9: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A10: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A11: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A12: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A13: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A14: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }
A15: { start: { val: 150, fct: 50 }, swarm_init: { val: [120, 160], fct: [0, 50] }, boundaries: { val: [0, 180], fct: [0, 150]} }

# 10. INITIAL FORCE FIELD PARAMETERS FOR NON-BONDED TERMS
init_nonbonded: # must correspond to bead types as defined in your input ITP files
Expand Down Expand Up @@ -173,18 +173,13 @@ exp_data:

# 15. WEIGHT/CONFIDENCE ATTRIBUTED TO/INTO THE REFERENCE AA TRAJECTORIES
reference_AA_weight: # setting value to 0 will disable the usage of the bottom-up component for a given lipid
POPC: 1.0
DOPC: 1.0
DPPC: 1.0
DMPC: 1.0
DLPC: 1.0
SDPC: 0.75
PDPC: 0.75
DSPC: 0
POPC:
303K: 1.0
DOPC:
303K: 1.0

# 16. OTHERS PARAMETERS (SHOULD NOT NEED CHANGES)
sim_kill_delay: 60 # number of seconds after which a simulation will be killed if it did not write in its log file
bonds2angles_scoring_factor: 500
next_cycle: False # for restarting from the single best set of FF parameters in a previous optimization output directory
row_x_scaling: True # use the same scale on all X axes for bond and angle distribution plots
row_y_scaling: True # use the same scale on all Y axes for bond and angle distribution plots
5 changes: 3 additions & 2 deletions optimize_lipids.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@
ns.opti_moves_details_lipid_temp_file = 'opti_moves_details_lipid_temp.log' # score parts and all info per lipid+temp
ns.opti_moves_times_file = 'opti_moves_times.log'

if not os.path.isdir(f"{config.data_aa_storage_dir}"):
os.mkdir(f"{config.data_aa_storage_dir}")

# careful if continuing into an output directory of a previous optimization run
fstpso_checkpoint_in = None # by default we assume there is no checkpoint
fstpso_checkpoint_in_nb = 0
Expand Down Expand Up @@ -942,7 +945,6 @@
geom_grp_std = 'Unknown'

# DISABLED BLOCK BELOW SO THAT WE ALWAYS START FROM ALL THE VALUES PRESENT IN THE CONFIG FILE
ns.params_val[geom_grp]['ref_eq_val'] = ns.user_config['init_bonded'][geom_grp]['val']
# by default we start from the values in the config file, and we instead start from the AA average if the parameter has to be tuned
# in case we have no AA reference data, then we fall back to the values in the config file
# if geom_grp in ns.user_config['tune_bonds_equi_val'] and geom_grp_avg != 'Unknown':
Expand Down Expand Up @@ -990,7 +992,6 @@
geom_grp_std = 'Unknown'

# DISABLED BLOCK BELOW SO THAT WE ALWAYS START FROM ALL THE VALUES PRESENT IN THE CONFIG FILE
ns.params_val[geom_grp]['ref_eq_val'] = ns.user_config['init_bonded'][geom_grp]['val']
# by default we start from the values in the config file, and we instead start from the AA average if the parameter has to be tuned
# in case we have no AA reference data, then we fall back to the values in the config file
# if geom_grp in ns.user_config['tune_angles_equi_val'] and geom_grp_avg != 'Unknown':
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c4e5b8f

Please sign in to comment.