Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of virtual sites and better compatibility with MARTINI 3 #8

Merged
merged 45 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9ace768
Add gititnore and codeowners
giovannidoni Sep 8, 2020
0400989
Merge pull request #3 from GMPavanLab/cleanup01
CharlyEmpereurmot Sep 8, 2020
9ee096e
reorder import
giovannidoni Sep 8, 2020
3432f4d
Add new files
giovannidoni Sep 8, 2020
8cc7396
Add tests and env
giovannidoni Sep 9, 2020
12c0a8a
Add other test
giovannidoni Sep 9, 2020
1377cfb
Merge pull request #4 from GMPavanLab/cleanup02
CharlyEmpereurmot Sep 9, 2020
cf38d61
Cleanup03 (#5)
giovannidoni Sep 10, 2020
79c5098
Added more exceptions
giovannidoni Sep 10, 2020
ad19451
Add tests
giovannidoni Sep 10, 2020
0972709
Add missing imports
giovannidoni Sep 10, 2020
54ee2f5
Fix test
giovannidoni Sep 10, 2020
a9e7ae3
Reintroduce main for entrypoints
giovannidoni Sep 10, 2020
cbf9f98
Adding exceptions to swarmCG
giovannidoni Sep 11, 2020
6d15ec6
More exceptions
giovannidoni Sep 11, 2020
b14ee79
Finished exceptions
giovannidoni Sep 11, 2020
fbe6346
Move pontentials in new folder
giovannidoni Sep 11, 2020
85f93d7
Merge pull request #6 from GMPavanLab/add-exceptions
CharlyEmpereurmot Sep 11, 2020
6051f03
Error handling of VS reader from .itp
fiskissimo Sep 15, 2020
48f5c5f
Added the options to write the VS in the itp output
fiskissimo Sep 15, 2020
79b5518
CG trajectory builder
fiskissimo Sep 16, 2020
3e61eee
Creation of the aa2cg_trajectory universe: need to fetch the atom mas…
fiskissimo Sep 17, 2020
e59d5a7
Created a list for the masses associated to the atomtypes (ns.cg_ato…
fiskissimo Sep 17, 2020
c3d10bb
AA to CG trajectory conversion in map_aa2cg_traj(ns)
fiskissimo Sep 21, 2020
13de889
new aa2cg distribution estimation and call of the conversion
fiskissimo Sep 21, 2020
da78181
Code working on evaluate_model (VS not tested)
fiskissimo Sep 23, 2020
1f624f5
MOT-CG handling VS_n
fiskissimo Sep 23, 2020
163721e
ongoing
CharlyEmpereurmot Sep 24, 2020
23f133f
Added VS functions + Fixed BI
CharlyEmpereurmot Sep 27, 2020
6d6c409
Changing authors display for paper + Some light cleaning
CharlyEmpereurmot Sep 27, 2020
660a81e
Rolled back the mass writing in the ITP if masses are present
CharlyEmpereurmot Sep 27, 2020
8867597
Corrected some line numbers in error messages
CharlyEmpereurmot Sep 27, 2020
b99d3fd
Fixed bug SASA + Fixed paths + VS ongoing
CharlyEmpereurmot Sep 30, 2020
a04fcb8
Fix VS (missing only vs3 func 3, 4 + vs4 func 2) + Fix MDP (Luca) + C…
CharlyEmpereurmot Oct 1, 2020
afaa7b7
Fix dihedral verify func + Enable evaluate model without args + Paths…
CharlyEmpereurmot Oct 1, 2020
fcee475
Added and validated vs3_func3 + Some cleaning
CharlyEmpereurmot Oct 1, 2020
140271f
Added and validated vs3_func4 + Some cleaning
CharlyEmpereurmot Oct 2, 2020
e5eeea8
Modified README to indicate virtual sites and MARTINI 3 are supported
CharlyEmpereurmot Oct 2, 2020
686517a
Integrated some changes that were not sent in the few last commits
CharlyEmpereurmot Oct 2, 2020
a84ae99
Added and validated vs4 func_2
CharlyEmpereurmot Oct 3, 2020
8d15ccb
Added choice between COM and COG for mapping interpretation
CharlyEmpereurmot Oct 3, 2020
a72d8da
Merge pull request #7 from GMPavanLab/vs_suite
CharlyEmpereurmot Oct 3, 2020
068cbfb
Correctly read multiline sections from NDX file
CharlyEmpereurmot Oct 3, 2020
81b33c4
Correctly read multiline sections from NDX file
CharlyEmpereurmot Oct 3, 2020
a997429
Merge remote-tracking branch 'origin/develop' into develop
CharlyEmpereurmot Oct 3, 2020
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
104 changes: 104 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
.venv/
venv/
ENV/

# Spyder project settings
.spyderproject

# IDEs
.idea/
.vscode/

# Rope project settings
.ropeproject

# mypy
.mypy_cache/

# pytest
.pytest_cache/

# data
/distributions.png
/G1_DATA/.aa_traj.xtc_offsets.npz
/G1_DATA/.cg_traj.xtc_offsets.npz
37 changes: 37 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @CharlyEmpereurmot

# Order is important; the last matching pattern takes the most
# precedence. When someone opens a pull request that only
# modifies JS files, only @js-owner and not the global
# owner(s) will be requested for a review.
*.py @CharlyEmpereurmot @giovannidoni

# You can also use email addresses if you prefer. They'll be
# used to look up users just like we do for commit author
# emails.
# *.go [email protected]

# In this example, @doctocat owns any files in the build/logs
# directory at the root of the repository and any of its
# subdirectories.
# /build/logs/ @doctocat

# The `docs/*` pattern will match files like
# `docs/getting-started.md` but not further nested files like
# `docs/build-app/troubleshooting.md`.
# docs/* [email protected]

# In this example, @octocat owns any file in an apps directory
# anywhere in your repository.
# apps/ @octocat

# In this example, @doctocat owns any file in the `/docs`
# directory in the root of your repository.
# /docs/ @doctocat
4 changes: 2 additions & 2 deletions G1_DATA/cg_map.ndx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[ N0 ]
5 8 57 74
[ Nda ]
13 16 18 19 20
13 16 18 19 20
[ N0 ]
9 10 77 97
[ Nda ]
Expand All @@ -15,7 +15,7 @@
[ Qd ]
110 113
[ Nda ]
30 33 35 36 37
30 33 35 36 37
[ N0 ]
26 27 117 137
[ Nda ]
Expand Down
55 changes: 28 additions & 27 deletions G1_DATA/cg_model.itp
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@ G1 1
; id type resnr residue atom cgnr charge

1 N0 1 G1 A1 1 0.00000
2 N0 2 G1 A2 2 0.00000
3 Nda 3 G1 A3 3 0.00000
4 N0 4 G1 A4 4 0.00000
5 Nda 5 G1 A5 5 0.00000
6 Qd 6 G1 A6 6 1.00000
7 Nda 7 G1 A7 7 0.00000
8 Qd 8 G1 A8 8 1.00000
9 Nda 9 G1 A9 9 0.00000
10 N0 10 G1 A10 10 0.00000
11 Nda 11 G1 A11 11 0.00000
12 Qd 12 G1 A12 12 1.00000
13 Nda 13 G1 A13 13 0.00000
14 Qd 14 G1 A14 14 1.00000
15 Nda 15 G1 A15 15 0.00000
16 N0 16 G1 A16 16 0.00000
17 Nda 17 G1 A17 17 0.00000
18 Qd 18 G1 A18 18 1.00000
19 Nda 19 G1 A19 19 0.00000
20 Qd 20 G1 A20 20 1.00000
21 Nda 21 G1 A21 21 0.00000
22 N0 22 G1 A22 22 0.00000
23 Nda 23 G1 A23 23 0.00000
24 Qd 24 G1 A24 24 1.00000
25 Nda 25 G1 A25 25 0.00000
26 Qd 26 G1 A26 26 1.00000
2 N0 1 G1 A2 2 0.00000
3 Nda 1 G1 A3 3 0.00000
4 N0 1 G1 A4 4 0.00000
5 Nda 1 G1 A5 5 0.00000
6 Qd 1 G1 A6 6 1.00000
7 Nda 1 G1 A7 7 0.00000
8 Qd 1 G1 A8 8 1.00000
9 Nda 1 G1 A9 9 0.00000
10 N0 1 G1 A10 10 0.00000
11 Nda 1 G1 A11 11 0.00000
12 Qd 1 G1 A12 12 1.00000
13 Nda 1 G1 A13 13 0.00000
14 Qd 1 G1 A14 14 1.00000
15 Nda 1 G1 A15 15 0.00000
16 N0 1 G1 A16 16 0.00000
17 Nda 1 G1 A17 17 0.00000
18 Qd 1 G1 A18 18 1.00000
19 Nda 1 G1 A19 19 0.00000
20 Qd 1 G1 A20 20 1.00000
21 Nda 1 G1 A21 21 0.00000
22 N0 1 G1 A22 22 0.00000
23 Nda 1 G1 A23 23 0.00000
24 Qd 1 G1 A24 24 1.00000
25 Nda 1 G1 A25 25 0.00000
26 Qd 1 G1 A26 26 1.00000


[ bonds ]
; i j funct length force.c.
; i j funct length force.c.

; bond group 1
1 2 1 0 0 ; B1
Expand Down Expand Up @@ -72,7 +72,7 @@ G1 1


[ angles ]
; i j k funct angle force.c.
; i j k funct angle force.c.

; angle group 1
1 2 15 2 120 0 ; A1
Expand Down Expand Up @@ -114,3 +114,4 @@ G1 1
22 23 24 2 180 0 ; A5
22 25 26 2 180 0 ; A5


Binary file added G1_DATA/cg_topol.tpr
Binary file not shown.
Binary file added G1_DATA/cg_traj.xtc
Binary file not shown.
3 changes: 2 additions & 1 deletion G1_DATA/start_conf.gro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
g1_GMX.gro created by acpype (Rev: 10101) on Thu Sep 12 17:34:03 2019 t= 0.00000 step= 0
1281
1282
1PG1 N1 1 2.936 2.913 2.508
1PG1 C2 2 2.896 2.600 2.705
1PG1 H7 3 3.134 3.247 2.318
Expand All @@ -26,6 +26,7 @@ g1_GMX.gro created by acpype (Rev: 10101) on Thu Sep 12 17:34:03 2019 t= 0.000
1PG1 H9 24 2.384 3.105 3.680
1PG1 H11 25 3.353 3.308 3.377
1PG1 N7 26 3.705 3.490 3.432
1PG1 N7 26 3.705 3.490 3.432
2W W 27 0.084 3.595 3.359
3W W 28 0.460 2.488 2.882
4W W 29 3.165 2.218 0.652
Expand Down
4 changes: 2 additions & 2 deletions G1_DATA/system.top
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ G1 (PAMAM) in water
[ molecules ]
; Compound #mols
G1 1
W 1247
CL- 8
W 1248
CL- 8
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Swarm-CG

Swarm-CG is designed for automatically optimizing the bonded terms of a coarse-grained (CG) molecular model, in explicit or implicit solvent, with respect to a reference all-atom (AA) trajectory and starting from a preliminary CG model (topology and non-bonded parameters). The package is designed for usage with Gromacs and contains 3 modules for:
Swarm-CG is designed for automatically optimizing the bonded terms of a MARTINI-based coarse-grained (CG) molecular model, in explicit or implicit solvent, with respect to a reference all-atom (AA) trajectory and starting from a preliminary CG model (topology and non-bonded parameters). The package is designed for usage with Gromacs and contains 3 modules for:

1. Evaluating the bonded parametrization of a CG model
2. Optimizing bonded terms of a CG model
3. Monitoring an optimization procedure

![Swarm-CG](https://raw.githubusercontent.com/GMPavanLab/Swarm-CG/master/images/TOC_Swarm-CG_paper.png)

Swarm-CG works with MARTINI version 2 or 3. Virtual sites are correctly handled and the AA-to-CG mapping can be interpreted as Center of Mass (COM) or Center of Geometry (COG).

### Publication

> Empereur-mot, C.; Pesce, L.; Bochicchio, D.; Perego, C.; Pavan, G.M. (2020) Swarm-CG: Automatic Parametrization of Bonded Terms in Coarse-Grained Models of Simple to Complex Molecules via Fuzzy Self-Tuning Particle Swarm Optimization. [ChemRxiv. Preprint](https://doi.org/10.26434/chemrxiv.12613427)
> Empereur-mot, C.; Pesce, L.; Bochicchio, D.; Perego, C.; Pavan, G.M. (2020) Swarm-CG: Automatic Parametrization of Bonded Terms in MARTINI-based Coarse-Grained Models of Simple to Complex Molecules via Fuzzy Self-Tuning Particle Swarm Optimization. [ChemRxiv. Preprint](https://doi.org/10.26434/chemrxiv.12613427)

### Installation & Usage

Expand Down Expand Up @@ -41,7 +43,7 @@ Here is an ITP file extract from the demonstration data of [PAMAM G1](https://gi

The module `scg_evaluate` enables quick evaluation of the fit of bond, angle and dihedral distributions between a CG model trajectory and a reference AA model trajectory of an identical molecule, by producing a single comprehensive figure.

scg_evaluate -aa_tpr G1_DATA/aa_topol.tpr -aa_traj G1_DATA/aa_traj.xtc -cg_map G1_DATA/cg_map.ndx -cg_itp G1_DATA/cg_model.itp -cg_tpr your_cg.tpr -cg_traj your_cg.xtc
scg_evaluate -aa_tpr G1_DATA/aa_topol.tpr -aa_traj G1_DATA/aa_traj.xtc -cg_map G1_DATA/cg_map.ndx -cg_itp G1_DATA/cg_model.itp -cg_tpr G1_DATA/cg_topol.tpr -cg_traj G1_DATA/cg_traj.xtc

It can also be used for inspecting AA-mapped distributions exclusively.

Expand Down
24 changes: 24 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: swarmcg
channels:
- conda-forge
dependencies:
- cycler=0.10.0
- dscribe=0.4.0 # 0.3.5 available for linux
- matplotlib=3.2.0 # 3.2.1 available
- mdanalysis>=1.0.0
- mypy=0.770
- numpy=1.19.1
- pandas=1.0.1
- pip
- pybind11=2.4.3 # 2.5.0 available
- pyemd=0.5.1
- pylint=2.4.4
- pytest=5.4.1
- pytest-runner=5.2
- python=3.7.6
- scikit-learn=0.22.2.post1
- scipy=1.4.1
- setuptools
- wheel
- pip:
- fst-pso
18 changes: 10 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
from setuptools import setup, find_packages

import swarmcg

with open('README.md') as readme_file:
README = readme_file.read()

setup(
name='swarm-cg',
version='v1.1.2',
version=swarmcg.__version__,
description='Tools for automatic parametrization of bonded terms in coarse-grained molecular models, with respect to an all-atom trajectory',
author='Charly Empereur-mot',
author_email='[email protected]',
author='Charly Empereur-mot',
author_email='[email protected]',
license='MIT',
url = 'https://github.com/GMPavanLab/Swarm-CG',
url = 'https://github.com/GMPavanLab/Swarm-CG',
long_description=README,
long_description_content_type="text/markdown",
keywords = ['gromacs', 'coarse-grain', 'molecular model', 'optimization', 'force field'],
keywords=['gromacs', 'coarse-grain', 'molecular model', 'optimization', 'force field'],
packages=find_packages(include=['swarmcg', 'swarmcg.*']),
install_requires=[
'numpy>=1.16.4',
Expand All @@ -25,9 +27,9 @@
],
entry_points={
'console_scripts': [
'scg_optimize=swarmcg.optimize_model:main',
'scg_evaluate=swarmcg.evaluate_model:main',
'scg_monitor=swarmcg.analyze_optimization:main'
'scg_optimize=swarmcg.optimize_model:main',
'scg_evaluate=swarmcg.evaluate_model:main',
'scg_monitor=swarmcg.analyze_optimization:main'
]
}
)
Expand Down
1 change: 1 addition & 0 deletions swarmcg/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '1.1.3'
Loading