From 4432eec25260b037adf3d11a8fed9da7a832d244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Municoy?= Date: Mon, 24 Aug 2020 22:26:26 +0200 Subject: [PATCH 1/3] Update releasehistory.rst --- docs/releasehistory.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/releasehistory.rst b/docs/releasehistory.rst index 8b8d7ec9..fe689b6b 100644 --- a/docs/releasehistory.rst +++ b/docs/releasehistory.rst @@ -7,10 +7,19 @@ Releases follow the ``major.minor.micro`` scheme recommended by `PEP440 `_: Adds a new method to define a `Molecule` object through a SMILES tag. This molecule can be written as a PDB file later for PELE. + +Bugfixes +"""""""" +- `PR #22 `_: Fixes many bugs. For example, the default output name of the solvent parameters template is changed to `ligandParams.txt`, which is the name that PELE expects. 0.2.1 From c9871e7dd32d31a1a59c7230e40de82a6b227c57 Mon Sep 17 00:00:00 2001 From: Marti Municoy Date: Fri, 28 Aug 2020 01:59:01 +0200 Subject: [PATCH 2/3] Include OPLS nonbonding parameters --- offpele/data/parameters/f14_sgbnp.param | 64 ++ offpele/data/parameters/similarity.param | 905 +++++++++++++++++++++++ offpele/template/impact.py | 12 +- offpele/topology/molecule.py | 152 +++- offpele/utils/toolkits.py | 297 +++++++- 5 files changed, 1421 insertions(+), 9 deletions(-) create mode 100644 offpele/data/parameters/f14_sgbnp.param create mode 100644 offpele/data/parameters/similarity.param diff --git a/offpele/data/parameters/f14_sgbnp.param b/offpele/data/parameters/f14_sgbnp.param new file mode 100644 index 00000000..9cecf066 --- /dev/null +++ b/offpele/data/parameters/f14_sgbnp.param @@ -0,0 +1,64 @@ +#------------------------------------------------------------------------------------------- +# symbl sigma epsilon rxnf_r cav_r gamma alpha # comments +#------------------------------------------------------------------------------------------- +1 CT 1.750 0.066 1.975 1.750 0.005000000 -0.741685710 # alkanes C +1 CT5 1.750 0.066 1.838 1.625 0.005000000 -0.741685710 # alkanes C +1 CT6 1.750 0.066 2.495 1.750 0.005000000 -0.741685710 # alkanes C +1 CM 1.775 0.076 2.002 1.775 0.023028004 -0.852763146 # alkene C +1 CZ 1.825 0.150 2.058 1.825 0.025318638 -1.264311570 # alkyne C +1 CZN 1.625 0.066 1.810 1.600 0.025318638 -1.264311570 # nitrile C +1 CA 1.775 0.070 2.002 1.775 0.001000000 -0.843144165 # aromatic C +1 CA2 1.775 0.070 2.500 1.775 0.001000000 -0.843144165 # aromatic C +1 CA8 1.875 0.105 2.112 1.875 0.001000000 -0.126889456 # guanidine or guanidium +1 C 1.875 0.105 2.112 1.875 0.001000000 -0.126889456 # carbonyl C +1 CO2 1.875 0.105 2.112 1.875 0.001000000 -0.126889456 # carboxylate C +1 CN 1.875 0.105 1.925 1.700 0.001000000 -0.126889456 # carbonyl C of amides +1 C* 1.875 0.105 2.112 1.875 0.001000000 -0.126889456 # default C +2 O 1.480 0.210 1.678 1.480 0.001000000 -0.126889456 # carbonyl O +2 O2 1.480 0.210 1.700 1.500 0.001000000 -0.126889456 # carboxylate O +2 OC3 1.480 0.210 1.975 1.750 0.001000000 -0.126889456 # carboxylic acid, C=O +2 OCN1 1.480 0.210 1.810 1.600 0.001000000 -1.480495490 # carbonyl O (primary amide) +2 OCN 1.480 0.210 1.525 1.425 0.001000000 -1.480495490 # carbonyl O (general amide) +2 OH2 1.560 0.170 1.838 1.625 0.021068034 -0.322181743 # alcohols, phenols +2 OH 1.560 0.170 1.766 1.560 0.021068034 -0.322181743 # alcohols, phenols +2 OS 1.450 0.140 1.590 1.400 0.020110767 -0.896042159 # ethers, esters +2 OS2 1.450 0.140 1.766 1.560 0.020110767 -0.896042159 # ethers, esters +2 ON 1.480 0.170 1.865 1.650 0.020881802 -0.347800883 # nitro R-NO2 +2 OZ 1.350 0.280 1.535 1.350 0.001000000 -0.126889456 # sulfoxide +2 OY 1.480 0.170 1.678 1.480 0.001000000 -0.126889456 # sulfonamide,sulfamide +2 O* 1.450 0.140 1.645 1.450 0.001000000 -0.126889456 # default O +3 N 1.625 0.170 1.810 1.600 0.054801302 -1.445846770 # amides +3 NY2 1.640 0.170 1.925 1.700 0.054801302 -2.445846770 # guanidine, etc. +3 NY 1.625 0.170 2.112 1.875 0.051222218 -2.220205820 # guanidine, etc. +3 NT 1.650 0.170 1.865 1.650 0.051222218 -2.220205820 # amines +3 NT2 1.650 0.170 2.112 1.875 0.051222218 -2.220205820 # amines +3 NT3 1.650 0.170 1.905 1.686 0.051222218 -2.220205820 # amines +3 NO 1.625 0.120 1.865 1.650 0.020864068 -0.347800883 # nitro N +3 NZ 1.640 0.170 2.250 2.000 0.024786691 -1.117108600 # nitrile N +3 NA 1.625 0.170 1.865 1.650 0.001000000 -0.511443539 # aromatic N +3 NA2 1.625 0.170 1.800 1.600 0.001000000 -0.511443539 # aromatic N +3 NAP 1.625 0.170 1.975 1.750 0.001000000 -0.511443539 # ionic aromatic N +3 NP00 1.625 0.170 1.948 1.725 0.003973653 1.685851020 # NH4+ +3 NP0 1.625 0.170 2.008 1.780 0.003973653 1.685851020 # NH3+, etc. +3 NP1 1.625 0.170 2.195 1.950 0.003973653 1.685851020 # NH3+, etc. +3 NP 1.625 0.170 2.290 2.036 0.003973653 1.685851020 # NH3+, etc. +3 N* 1.650 0.170 1.865 1.650 0.005000000 -0.511443539 # default N +3 NN 1.650 0.170 1.837 1.625 0.005000000 0.000000000 # NN bridge +4 S 1.800 0.355 2.030 1.800 0.025682759 -1.666211680 # Sulfides, thiols +4 SY 1.775 0.250 2.002 1.775 0.025682759 -1.666211680 # sulfonamide, sulfamide +4 SZ 1.780 0.395 2.008 1.780 0.025682759 -1.666211680 # sulfoxide +4 SA 1.800 0.355 2.030 2.125 0.025682759 -1.666211680 # terminal S +4 S* 1.800 0.355 2.030 1.800 0.025682759 -1.666211680 # default S +5 HC 1.250 0.030 1.425 1.250 0.008598240 0.268726247 # H on aliphatic C +5 HC7 1.210 0.015 1.381 1.210 0.008598240 0.268726247 # H on aliphatic C +5 HC9 1.250 0.030 1.645 1.450 0.008598240 0.268726247 # H on aliphatic C +5 HA 1.210 0.030 1.381 1.210 0.030040813 0.268726247 # H on aromatic C +5 H 0.000 0.000 0.996 0.860 0.030040813 -0.651083722 # H on polar atom +5 HN 0.000 0.000 1.590 1.400 0.030040813 -0.651083722 # H on polar atom +5 H* 1.250 0.030 1.425 1.250 0.008598240 0.268726247 # default H +6 F 1.470 0.061 2.498 2.225 0.001000000 0.985400000 # F +6 Cl 1.700 0.300 2.195 1.950 0.001000000 0.320982824 # Cl +6 Br 1.735 0.470 2.800 2.500 0.001000000 -0.686339560 # Br +6 I 1.875 0.060 2.112 1.875 0.001000000 -0.848554734 # I +7 P2 1.875 0.200 2.107 1.870 0.005000000 0.000000000 # P +8 DF 0.000 0.000 1.500 1.250 0.005000000 0.000000000 # default diff --git a/offpele/data/parameters/similarity.param b/offpele/data/parameters/similarity.param new file mode 100644 index 00000000..660bdda7 --- /dev/null +++ b/offpele/data/parameters/similarity.param @@ -0,0 +1,905 @@ +Br Br 100 +Br X 10 +C C 100 +C C? 10 +C3M C3M 100 +C3M CM 80 +C3M C? 10 +C3T C3T 100 +C3T CT 80 +C3T C? 10 +C4 C4 100 +C4 C 80 +C4 C? 10 +CM7 CM7 100 +CM7 CM 80 +CM7 C 50 +CM7 C? 10 +C4M C4M 100 +C4M CM 80 +C4M C? 10 +C4T C4T 100 +C4T CT 80 +C4T C? 10 +C356 C356 100 +C356 CA 50 +C356 C? 10 +C5 C5 100 +C5 CA5 80 +C5 CA 50 +C5 C? 10 +C55 C55 100 +C55 CA5 80 +C55 CA 50 +C55 C? 10 +C55A C55A 100 +C55A CA5 80 +C55A CA 50 +C55A C? 10 +C56A C56A 100 +C56A CA5 80 +C56A CA 50 +C56A C? 10 +C56B C56B 100 +C56B CA5 80 +C56B CA 50 +C56B C? 10 +C56P C56P 100 +C56P CA5 80 +C56P CA 50 +C56P C? 10 +C56X C56X 100 +C56X CA5 80 +C56X CA 50 +C56X C? 10 +C57 C57 100 +C57 CA5 80 +C57 CA 50 +C57 C? 10 +C5A C5A 100 +C5A CA5 80 +C5A CA 50 +C5A C? 10 +C5B C5B 100 +C5B CA5 80 +C5B CA 50 +C5B C? 10 +C5BB C5BB 100 +C5BB CA5 80 +C5BB CA 50 +C5BB C? 10 +C5BC C5BC 100 +C5BC CA5 80 +C5BC CA 50 +C5BC C? 10 +C5BD C5BD 100 +C5BD CA5 80 +C5BD CA 50 +C5BD C? 10 +C5M C5M 100 +C5M CA5 80 +C5M CA 50 +C5M C? 10 +C5N C5N 100 +C5N CA5 80 +C5N CA 50 +C5N C? 10 +C5W C5W 100 +C5W CA5 80 +C5W CA 50 +C5W C? 10 +C5X C5X 100 +C5X CA5 80 +C5X CA 50 +C5X C? 10 +C7 C7 100 +C7 CA 80 +C7 C? 10 +CAz CAz 100 +CAz CA 60 +CAz C? 10 +CA CA 100 +CA C? 10 +CA5 CA5 100 +CA5 CA 50 +CA5 C? 10 +CAA CAA 100 +CAA CA 50 +CAA C? 10 +CAB CAB 100 +CAB CA 50 +CAB CA5 40 +CAB C? 10 +CB CB 100 +CB CA5 80 +CB CA 50 +CB C? 10 +CD CD 100 +CD CM 50 +CD C? 10 +CDS CDS 100 +CDS C 50 +CDS C? 10 +CDX CDX 100 +CDX CD 80 +CDX CM 50 +CDX C? 10 +CDZ CDZ 100 +CDZ CD 80 +CDZ CM 50 +CDZ C? 10 +CG CG 100 +CG CD 80 +CG CM 50 +CG C? 10 +CHZ CHZ 100 +CHZ CD 80 +CHZ CM 50 +CHZ C? 10 +CIN CIN 100 +CIN CZ 80 +CIN C? 10 +CM CM 100 +CM C? 10 +CMz CMz 100 +CMz CM 50 +CMz C? 10 +CMA CMA 100 +CMA CM 80 +CMA C? 10 +CN CN 100 +CN CA5 80 +CN CA 50 +CN C? 10 +CN55 CN55 100 +CN55 CA5 80 +CN55 CA 50 +CN55 C? 10 +CN56 CN56 100 +CN56 CA5 80 +CN56 CA 50 +CN56 C? 10 +CNA CNA 100 +CNA CM 80 +CNA CD 50 +CNA C? 10 +CO CO 100 +CO CT 80 +CO C? 10 +CO1 CO1 100 +CO1 CT 80 +CO1 C? 10 +CO3 CO3 100 +CO3 C 80 +CO3 C? 10 +CO4 CO4 100 +CO4 C 80 +CO4 C? 10 +CP1 CP1 100 +CP1 CT 80 +CP1 C? 10 +CQ CQ 100 +CQ CA 50 +CQ C? 10 +CR CR 100 +CR CA5 80 +CR CA 50 +CR C? 10 +CR3 CR3 100 +CR3 CA 80 +CR3 C? 10 +CRA CRA 100 +CRA CA5 80 +CRA CA 50 +CRA C? 10 +CRAB CRAB 100 +CRAB CRA 90 +CRAB CA5 80 +CRAB CA 50 +CRAB C? 10 +CRB CRB 100 +CRB CA 80 +CRB C? 10 +CRP CRP 100 +CRP CA5 80 +CRP CA 50 +CRP C? 10 +CS CS 100 +CS CA 80 +CS C? 10 +CT CT 100 +CT C? 10 +CT1 CT1 100 +CT1 CT 80 +CT1 C? 10 +CT2 CT2 100 +CT2 CT 80 +CT2 C? 10 +CT3 CT3 100 +CT3 CT 80 +CT3 C? 10 +CT4 CT4 100 +CT4 CA5 80 +CT4 CA 50 +CT4 C? 10 +CTA CTA 100 +CTA CT 80 +CTA C? 10 +CTB CTB 100 +CTB CT 80 +CTB C? 10 +CTC CTC 100 +CTC CT 80 +CTC C? 10 +CTD CTD 100 +CTD CT 80 +CTD C? 10 +CTE CTE 100 +CTE CT 80 +CTE C? 10 +CTF CTF 100 +CTF CT 80 +CTF C? 10 +CTG CTG 100 +CTG CT 80 +CTG C? 10 +CTH CTH 100 +CTH CT 80 +CTH C? 10 +CTI CTI 100 +CTI CT 80 +CTI C? 10 +CTJ CTJ 100 +CTJ CT 80 +CTJ C? 10 +CTK CTK 100 +CTK CT 80 +CTK C? 10 +CTL CTL 100 +CTL CT 80 +CTL C? 10 +CTM CTM 100 +CTM CT 80 +CTM C? 10 +CTN CTN 100 +CTN CT 80 +CTN C? 10 +CTO CTO 100 +CTO CT 80 +CTO C? 10 +CTP CTP 100 +CTP CT 80 +CTP C? 10 +CTQ CTQ 100 +CTQ CT 80 +CTQ C? 10 +CTR CTR 100 +CTR C 80 +CTR C? 10 +CTR CM 50 +CTS CTS 100 +CTS CT 80 +CTS C? 10 +CTT CTT 100 +CTT CT 80 +CTT C? 10 +CW CW 100 +CW CA 80 +CW C? 10 +CZ CZ 100 +CZ C? 10 +CZA CZA 100 +CZA CZ 80 +CZA C? 10 +Cl Cl 100 +Cl X 10 +F F 100 +F X 10 +Fe3+ Fe3+ 100 +Fe3+ Fe 50 +Fe3+ Fe? 10 +Fe2+ Fe2+ 100 +Fe2+ Fe 50 +Fe2+ Fe? 10 +Fe Fe 100 +Fe Fe? 10 +H H 100 +H H? 10 +HA HA 100 +HA H 50 +HA H? 10 +HC HC 100 +HC H? 10 +HO HO 100 +HO H 50 +HO H? 10 +HP HP 100 +HP HC 50 +HP H? 10 +HS HS 100 +HS H 50 +HS H? 10 +HSi HSi 100 +HSi HC 50 +HSi H? 10 +HT3 HT3 100 +HT4 HT4 100 +HWS HWS 100 +I I 100 +I X 10 +MT4 MT4 100 +N N 100 +N N? 10 +N4 N4 100 +N4 N 40 +N4 N? 10 +N* N* 100 +N* NA 80 +N* N 60 +N* NB 50 +N* N? 10 +N3 N3 100 +N3T N3T 100 +N3T NT 80 +N3T N? 10 +N4T N4T 100 +N4T NT 80 +N4T N? 10 +N4M N4M 100 +N4M NI 80 +N4M N? 10 +N55 N55 100 +N55 NA 80 +N55 NB 50 +N55 N? 10 +N56P N56P 100 +N56P NA 80 +N56P NB 50 +N56P N? 10 +N5A N5A 100 +N5A NB 50 +N5A N? 10 +N5B N5B 100 +N5B N5A 80 +N5B NB 50 +N5B N? 10 +N5M N5M 100 +N5M N5A 80 +N5M NB 50 +N5M N? 10 +N5P N5P 100 +N5P NA 80 +N5P NB 50 +N5P N? 10 +NB NB 100 +NB N? 10 +N5Bz N5Bz 100 +N5Bz N5B 50 +N5Bz NB 50 +N5Bz N? 10 +NBz NBz 100 +NBz NB 60 +NBz N? 10 +NA NA 100 +NA NB 50 +NA N? 10 +NA5B NA5B 100 +NA5B N5A 80 +NA5B NB 50 +NA5B N? 10 +NA6 NA6 100 +NA6 NB 80 +NA6 N? 10 +NAA NAA 100 +NAA N5A 80 +NAA NB 50 +NAA N? 10 +NAB NAB 100 +NAB N5A 80 +NAB NB 50 +NAB N? 10 +NAP NAP 100 +NAP NB 50 +NAP N? 10 +NAX NAX 100 +NAX NAP 80 +NAX NB 50 +NAX N? 10 +NA5 NA5 100 +NA5 NA 80 +NA5 NB 50 +NA5 N? 10 +NC NC 100 +NC NB 50 +NC N? 10 +NC55 NC55 100 +NC55 NA 80 +NC55 NB 50 +NC55 N? 10 +NC56 NC56 100 +NC56 NA 80 +NC56 NB 50 +NC56 N? 10 +NE NE 100 +NE N 50 +NE N? 10 +NG NG 100 +NG NE 80 +NG N 50 +NG N? 10 +NH NH 100 +NH NT 80 +NH N? 10 +NHZ NHZ 100 +NHZ NE 80 +NHZ N 50 +NHZ N? 10 +NI NI 100 +NI N? 10 +NIN NIN 100 +NIN NZ 80 +NIN N? 10 +NIP NIP 100 +NIP N? 10 +NIX NIX 100 +NIX NIP 80 +NIX N? 10 +NM NM 100 +NM NS 80 +NM N? 10 +NMX NMX 100 +NMX NM 80 +NMX N? 10 +NN NN 100 +NN NI 80 +NN N? 10 +NNA NNA 100 +NNA N5A 80 +NNA NB 50 +NNA N? 10 +NNB NNB 100 +NNB N 80 +NNB N? 10 +NNC NNC 100 +NNC NI 80 +NNC NB 60 +NNC N 50 +NNC N? 10 +NND NND 100 +NND NE 80 +NND N 50 +NND N? 10 +NNE NNE 100 +NNE N 80 +NNE N? 10 +NNF NNF 100 +NNF NA 80 +NNF NB 50 +NNF N? 10 +NO NO 100 +NO NI 80 +NO N? 10 +NO2 NO2 100 +NO2 N? 10 +NO3 NO3 100 +NO3 NO2 50 +NO3 N? 10 +NOM NOM 100 +NOM NO2 50 +NOM N? 10 +NP NP 100 +NP NT 30 +NP N? 10 +NP56 NP56 100 +NP56 NA 80 +NP56 NB 50 +NP56 N? 10 +NR3 NR3 100 +NR3 NA 80 +NR3 NB 50 +NR3 N? 10 +NS NS 100 +NS NT 50 +NS N? 10 +NST NST 100 +NST NI 80 +NST N? 10 +NT NT 100 +NT N? 10 +NTX NTX 100 +NTX NP 80 +NTX NT 50 +NTX N? 10 +NX NX 100 +NX NT 50 +NX N? 10 +NX2 NX2 100 +NX2 NMX 50 +NX2 NM 25 +NX2 N? 10 +NY NY 100 +NY N 50 +NY N? 10 +NZ NZ 100 +NZ N? 10 +NZA NZA 100 +NZA NI 50 +NZA N? 10 +NZC NZC 100 +NZC NZ 80 +NZC NI 50 +NZC N? 10 +NZP NZP 100 +NZP NZ 50 +NZP N? 10 +NZT NZT 100 +NZT NZ 80 +NZT N? 10 +O O 100 +O O? 10 +O2Z O2Z 100 +O2Z O 50 +O2Z O? 10 +O3T O3T 100 +O3T OS 80 +O3T O? 10 +O4T O4T 100 +O4T OS 80 +O4T O? 10 +OA OA 100 +OA OS 40 +OA O? 10 +OC3 OC3 100 +OC3 O 50 +OC3 O? 10 +OH OH 100 +OH OS 50 +OH O? 10 +OH2 OH2 100 +OH2 OH 80 +OH2 OS 50 +OH2 O? 10 +OH5 OH5 100 +OH5 OH 80 +OH5 OS 50 +OH5 O? 10 +OM OM 100 +OM OS 50 +OM O? 10 +ON ON 100 +ON O2Z 80 +ON O 50 +ON O? 10 +ONX ONX 100 +ONX OM 80 +ONX O 50 +ONX O? 10 +OS OS 100 +OS O? 10 +OS1 OS1 100 +OS1 OS 80 +OS1 O? 10 +OT3 OT3 100 +OT4 OT4 100 +OWS OWS 100 +OY OY 100 +OY O 50 +OY O? 10 +OZ OZ 100 +OZ OM 60 +OZ O 50 +OZ O? 10 +P1 P1 100 +P1 P2 80 +P1 P? 10 +P2 P2 100 +P2 P2 80 +P2 P? 10 +P3 P3 100 +P3 P2 80 +P3 P? 10 +P4 P4 100 +P4 P2 80 +P4 P? 10 +PM PM 100 +PM P? 10 +PP PP 100 +PP P2 50 +PP P? 10 +PR PR 100 +PR P2 50 +PR P? 10 +S S 100 +S S? 10 +SD SD 100 +SD S? 10 +SX SX 100 +SX SD 50 +SX S? 10 +SA SA 100 +SA S 40 +SA S? 10 +SH SH 100 +SH S 50 +SH S? 10 +SM SM 100 +SM S 80 +SM S? 10 +SM2 SM2 100 +SM2 SM 80 +SM2 S? 10 +ST ST 100 +ST SD 80 +ST S? 10 +SX6 SX6 100 +SX6 S? 10 +SY SY 100 +SY S? 10 +SZ SZ 100 +SZ S? 10 +Sc Sc 100 +Si Si 100 +Si Si? 10 +SeX3 SeX3 100 +SeX3 Se? 10 +Se Se 100 +Se Se? 10 +N3M N3M 100 +N3M NI 80 +N3M N? 10 +N4M N4M 100 +N4M NI 80 +N4M N? 10 +CTV CTV 100 +CTV CT 80 +CTV C? 10 +CTW CTW 100 +CTW CT 80 +CTW C? 10 +HC7 HC7 100 +HC7 HC 80 +HC7 H? 10 +CA8 CA8 100 +CA8 CA 80 +CA8 C? 10 +COO COO 100 +COO CO 80 +COO CM 50 +COO C? 10 +N2 N2 100 +N2 N 80 +N2 N? 10 +H3 H3 100 +H3 H 80 +H3 H? 10 +C1 C1 100 +C1 C1 80 +C1 C 50 +C1 C? 10 +N1 N1 100 +N1 N 80 +N1 N? 10 +O1 O1 100 +O1 O 80 +O1 O? 10 +CG1 CG1 100 +CG1 CG 80 +CG1 CM 50 +CG1 C? 10 +O2 O2 100 +O2 O 80 +O2 O? 10 +OH7 OH7 100 +OH7 O 80 +OH7 O? 10 +CV CV 100 +CV CA 80 +CV C? 10 +CX CX 100 +CX CA 80 +CX C? 10 +NA1 NA1 100 +NA1 NA 80 +NA1 N? 10 +N3A N3A 100 +N3A N 80 +N3A N? 10 +C* C* 100 +C* C 80 +C* C? 10 +CB9 CB9 100 +CB9 C 80 +CB9 C? 10 +CA2 CA2 100 +CA2 CA 80 +CA2 C? 10 +OH6 OH6 100 +OH6 OH 80 +OH6 O? 10 +CTHO CTHO 100 +CTHO CT 80 +CTHO C? 10 +NTH0 NTH0 100 +NTH0 NT 50 +NTH0 N? 10 +NTH NTH 100 +NTH NT 50 +NTH N? 10 +NTH2 NTH2 100 +NTH2 NT 50 +NTH2 N? 10 +CTTD CTTD 80 +CTTD CT 80 +CTTD C? 10 +CTU CTU 80 +CTU CT 80 +CTU C? 10 +Al Al 100 +Al Al? 10 +Ir Ir 100 +Ir Ir? 10 +Li Li 100 +Mg Mg 100 +BT BT 100 +BT B? 10 +B B 100 +B B? 10 +As As 100 +As As? 10 +U U 100 +U M 30 +U U? 10 +V5+ V5+ 100 +#V5+ V 50 # out now, to avoid changing pdb_models_f14.out +V5+ V? 10 +V V 100 +V V? 10 +W W 100 +W W? 10 +Mo6+ Mo6+ 100 +#Mo6+ Mo 50 # out now, to avoid changing pdb_models_f14.out +Mo6+ Mo? 10 +Mo Mo 100 +Mo Mo? 10 +Zn2+ Zn2+ 100 +Zn2+ Zn 50 +Zn2+ Zn? 10 +Zn Zn 100 +Zn Zn? 10 +Cu2+ Cu2+ 100 +Cu2+ Cu 50 +Cu2+ Cu? 10 +Cu Cu 100 +Cu Cu? 10 +Ni2+ Ni2+ 100 +Ni2+ Ni 50 +Ni2+ Ni? 10 +Ni Ni 100 +Ni Ni? 10 +Pt2+ Pt2+ 100 +Pt2+ Pt 50 +Pt2+ Pt? 10 +Pt Pt 100 +Pt Pt? 10 +Du Du 100 +Du Du? 10 +# AACG extras +CDY CDY 100 +CDY CA 90 +CDY C? 10 +CE3W CE3W 100 +CE3W CA 50 +CE3W C? 10 +CEY CEY 100 +CEY CA 90 +CEY C? 10 +CF CF 100 +CF CA 90 +CF C? 10 +CGY CGY 100 +CGY CA 90 +CGY C? 10 +CH2W CH2W 100 +CH2W CA 50 +CH2W C? 10 +COOH COOH 100 +COOH C 80 +COOH C? 10 +CP2 CP2 100 +CP2 CT 80 +CP2 C? 10 +CP3 CP3 100 +CP3 CT 80 +CP3 C? 10 +CR1H CR1H 100 +CR1H CA5 80 +CR1H CA 50 +CR1H C? 10 +CRHH CRHH 100 +CRHH CA5 80 +CRHH CA 50 +CRHH C? 10 +CTH1 CTH1 100 +CTH1 CT 90 +CTH1 C? 10 +CTH2 CTH2 100 +CTH2 CT 90 +CTH2 C? 10 +CTH3 CTH3 100 +CTH3 CT 90 +CTH3 C? 10 +CZ2W CZ2W 100 +CZ2W CA 50 +CZ2W C? 10 +CZ3W CZ3W 100 +CZ3W CA 50 +CZ3W C? 10 +CZY CZY 100 +CZY CA 90 +CZY C? 10 +NH1 NH1 100 +NH1 N 95 +NH1 N? 10 +NH2 NH2 100 +NH2 N 95 +NH2 N? 10 +NP1 NP1 100 +NP1 N 90 +NP1 N? 10 +SS SS 100 +SS S 90 +SS S? 10 +CT1A CT1A 100 +CT1A CT1 95 +CT1R CT1R 100 +CT1R CT1 95 +CTRN CTRN 100 +CTRN CT1 95 +CTAH CTAH 100 +CTAH CT1 95 +CT1N CT1N 100 +CT1N CT1 95 +CT1D CT1D 100 +CT1D CT1 95 +CT1C CT1C 100 +CT1C CT1 95 +CT1X CT1X 100 +CT1X CT1 95 +CTGH CTGH 100 +CTGH CT1 95 +CT1Q CT1Q 100 +CT1Q CT1 95 +CT1E CT1E 100 +CT1E CT1 95 +CT1G CT1G 100 +CT1G CT1 95 +CTHD CTHD 100 +CTHD CT1 95 +CTHE CTHE 100 +CTHE CT1 95 +CTHP CTHP 100 +CTHP CT1 95 +CT1I CT1I 100 +CT1I CT1 95 +CT1L CT1L 100 +CT1L CT1 95 +CT1U CT1U 100 +CT1U CT1 95 +CT1K CT1K 100 +CT1K CT1 95 +CT1M CT1M 100 +CT1M CT1 95 +CT1F CT1F 100 +CT1F CT1 95 +CT1P CT1P 100 +CT1P CT1 95 +CT1S CT1S 100 +CT1S CT1 95 +CT1T CT1T 100 +CT1T CT1 95 +CT1W CT1W 100 +CT1W CT1 95 +CT1Y CT1Y 100 +CT1Y CT1 95 +CT1V CT1V 100 +CT1V CT1 95 \ No newline at end of file diff --git a/offpele/template/impact.py b/offpele/template/impact.py index 4ca5fa9f..08384669 100644 --- a/offpele/template/impact.py +++ b/offpele/template/impact.py @@ -129,7 +129,10 @@ def _write_header(self, file): """ file.write('* LIGAND DATABASE FILE') if self.molecule.forcefield: - file.write(' ({})'.format(self.molecule.forcefield)) + if self.molecule.OPLS_included: + file.write(' ({} + OPLS2005)'.format(self.molecule.forcefield)) + else: + file.write(' ({})'.format(self.molecule.forcefield)) file.write('\n') file.write('* File generated with offpele-{}\n'.format( offpele.__version__)) @@ -660,7 +663,7 @@ def OPLS_type(self): index : str The OLPS type of this Atom object """ - return 'OFFT' # stands for OpenForceField type + return super().OPLS_type # stands for OpenForceField type # TODO @property @@ -720,7 +723,7 @@ def charge(self): return super().charge @property - @WritableWrapper.none_to_zero + @WritableWrapper.in_angstrom def born_radius(self): """ Atom's Born radius. @@ -730,6 +733,9 @@ def born_radius(self): born_radius : float The Born radius of this Atom object """ + if super().born_radius is None: + return unit.Quantity(0, unit.angstroms) + return super().born_radius @property diff --git a/offpele/topology/molecule.py b/offpele/topology/molecule.py index 47e75647..bb6664a6 100644 --- a/offpele/topology/molecule.py +++ b/offpele/topology/molecule.py @@ -8,7 +8,8 @@ from .topology import Bond, Angle, OFFProper, OFFImproper from .rotamer import MolecularGraph from offpele.utils.toolkits import (RDKitToolkitWrapper, - OpenForceFieldToolkitWrapper) + OpenForceFieldToolkitWrapper, + SchrodingerToolkitWrapper) from offpele.charge import (Am1bccCalculator, GasteigerCalculator) @@ -119,6 +120,94 @@ def set_coords(self, coords): self._x, self._y, self._z = coords + def set_OPLS_type(self, OPLS_type): + """ + It sets the OPLS type of the atom. + + Parameters + ---------- + OPLS_type : str + The OPLS type to set to this Atom object + """ + self._OPLS_type = OPLS_type + + def set_sigma(self, sigma): + """ + It sets the sigma of the atom. + + Parameters + ---------- + sigma : float + The sigma to set to this Atom object + """ + self._sigma = sigma + + def set_epsilon(self, epsilon): + """ + It sets the epsilon of the atom. + + Parameters + ---------- + epsilon : float + The epsilon to set to this Atom object + """ + self._epsilon = epsilon + + def set_charge(self, charge): + """ + It sets the charge of the atom. + + Parameters + ---------- + charge : float + The charge to set to this Atom object + """ + self._charge = charge + + def set_born_radius(self, born_radius): + """ + It sets the Born radius of the atom. + + Parameters + ---------- + born_radius : float + The Born radius to set to this Atom object + """ + self._born_radius = born_radius + + def set_SASA_radius(self, SASA_radius): + """ + It sets the SASA radius of the atom. + + Parameters + ---------- + SASA_radius : float + The SASA radius to set to this Atom object + """ + self._SASA_radius = SASA_radius + + def set_nonpolar_gamma(self, nonpolar_gamma): + """ + It sets the nonpolar gamma of the atom. + + Parameters + ---------- + nonpolar_gamma : float + The nonpolar gamma to set to this Atom object + """ + self._nonpolar_gamma = nonpolar_gamma + + def set_nonpolar_alpha(self, nonpolar_alpha): + """ + It sets the nonpolar alpha of the atom. + + Parameters + ---------- + nonpolar_alpha : float + The nonpolar alpha to set to this Atom object + """ + self._nonpolar_alpha = nonpolar_alpha + @property def index(self): """ @@ -429,6 +518,7 @@ def _initialize(self): self._rotamers = None self._graph = None self._parameterized = False + self._OPLS_included = False def _initialize_from_pdb(self, path): """ @@ -508,7 +598,8 @@ def set_name(self, name): if self.off_molecule: self.off_molecule.name = name - def parameterize(self, forcefield, charges_method=None): + def parameterize(self, forcefield, charges_method=None, + use_OPLS_nonbonding_params=False): """ It parameterizes the molecule with a certain forcefield. @@ -519,6 +610,11 @@ def parameterize(self, forcefield, charges_method=None): The forcefield from which the parameters will be obtained charges_method : str The name of the charges method to employ + use_OPLS_nonbonding_params : bool + Whether to use Open Force Field or OPLS to obtain the + nonbonding parameters. Please, note that this option is only + available if a Schrodinger installation is found in the + current machine. Default is False """ if not self.off_molecule or not self.rdkit_molecule: @@ -559,6 +655,11 @@ def parameterize(self, forcefield, charges_method=None): self.graph.set_parents() + if use_OPLS_nonbonding_params: + self.add_OPLS_nonbonding_params() + else: + self._OPLS_included = False + # To do: consider removing this function def plot_rotamer_graph(self): """It plots the rotamer graph in screen.""" @@ -671,8 +772,7 @@ def _build_atoms(self): pdb_atom_names = {(i, ): name.replace(' ', '_',) for i, name in enumerate(self.get_pdb_atom_names())} - # TODO should we assign an OPLS type? How can we do this with OFF? - OPLS_types = {i: None + OPLS_types = {i: 'OFFT' for i in self.parameters.get_vdW_parameters().keys()} # TODO Which is the purpose of unknown value? Is it important? @@ -937,6 +1037,37 @@ def _add_OFF_improper(self, improper): """ self._OFF_impropers.append(improper) + def add_OPLS_nonbonding_params(self): + schrodinger_toolkit = SchrodingerToolkitWrapper() + + OPLS_params = schrodinger_toolkit.get_OPLS_parameters(self) + + atom_by_PDB_name = dict() + + for atom in self.atoms: + atom_by_PDB_name[atom.PDB_name] = atom + + for atom, atom_type, sigma, epsilon, charge, SGB_radius, \ + vdW_radius, gamma, alpha in zip(self.atoms, + OPLS_params['atom_types'], + OPLS_params['sigmas'], + OPLS_params['epsilons'], + OPLS_params['charges'], + OPLS_params['SGB_radii'], + OPLS_params['vdW_radii'], + OPLS_params['gammas'], + OPLS_params['alphas']): + atom.set_OPLS_type(atom_type) + atom.set_sigma(sigma) + atom.set_epsilon(epsilon) + atom.set_charge(charge) + atom.set_born_radius(SGB_radius) + atom.set_SASA_radius(vdW_radius) + atom.set_nonpolar_gamma(gamma) + atom.set_nonpolar_alpha(alpha) + + self._OPLS_included = True + def get_pdb_atom_names(self): """ It returns the PDB atom names of all the atoms in the molecule. @@ -1143,3 +1274,16 @@ def parameterized(self): The parameterization status """ return self._parameterized + + @property + def OPLS_included(self): + """ + Whether the molecule has been parameterized with OPLS in combination + with the Open Force Field toolkit or not. + + Returns + ------- + OPLS_included : bool + The OPLS combination status + """ + return self._OPLS_included diff --git a/offpele/utils/toolkits.py b/offpele/utils/toolkits.py index 4533cb74..ce9d2bf2 100644 --- a/offpele/utils/toolkits.py +++ b/offpele/utils/toolkits.py @@ -14,7 +14,7 @@ import numpy as np from simtk import unit -from offpele.utils import temporary_cd +from offpele.utils import temporary_cd, get_data_file_path class ToolkitUnavailableException(Exception): @@ -1048,7 +1048,7 @@ def get_GBSA_parameters(self): Returns ------- - GSBA_parameters : dict[tuple, openforcefield.typing.engines.smirnoff.parameters.ParameterHandler] + GSBA_parameters : dict[tuple, openforcefield.typing.engines.smirnoff.parameters.ParameterHandler] The parameters grouped by the atom ids they belong to (arranged as tuples) """ @@ -1080,3 +1080,296 @@ def get_GBSA_scales(self): """ parameters = self.get_GBSA_parameters() return self._build_dict(parameters, 'scale') + + +class SchrodingerToolkitWrapper(ToolkitWrapper): + """ + SchrodingerToolkitWrapper class. + """ + + _toolkit_name = 'Schrodinger Toolkit' + + def __init__(self): + """ + It initializes a SchrodingerToolkitWrapper object. + """ + super().__init__() + + if not self.is_available(): + raise ToolkitUnavailableException( + 'The required toolkit {self.toolkit_name} is not ' + 'available.') + + self._rdkit_toolkit_wrapper = RDKitToolkitWrapper() + + @staticmethod + def is_available(): + """ + Check whether the OpenForceField toolkit is installed + + Returns + ------- + is_installed : bool + True if OpenForceField is installed, False otherwise. + """ + if not(RDKitToolkitWrapper.is_available()): + return False + + if SchrodingerToolkitWrapper.path_to_ffld_server() is None: + return False + + return True + + @staticmethod + def path_to_ffld_server(): + FFLD_SERVER_PATH = find_executable("ffld_server") + + if FFLD_SERVER_PATH is not None: + return FFLD_SERVER_PATH + + else: + if "SCHRODINGER" in os.environ: + schrodinger_root = os.environ.get('SCHRODINGER') + return os.path.join(schrodinger_root, + 'utilities', 'ffld_server') + + return None + + def get_OPLS_parameters(self, molecule): + """ + It calls Schrodinger's ffld_server to parameterize a molecule + with OPLS. + + .. todo :: + + * Review PlopRotTemp's atom type fixes. Should we apply them here? + + Parameters + ---------- + molecule : an offpele.topology.Molecule + The offpele's Molecule object + + Returns + ------- + parameters ? + """ + + ffld_server_exec = self.path_to_ffld_server() + + with tempfile.TemporaryDirectory() as tmpdir: + with temporary_cd(tmpdir): + + self._rdkit_toolkit_wrapper.to_pdb_file( + molecule, tmpdir + '/molecule.pdb') + + subprocess.check_output([ffld_server_exec, + "-ipdb", "molecule.pdb", + "-version", "14", + "-print_parameters", + "-out_file", "parameters.txt"]) + + OPLS_params = self._parse_parameters('parameters.txt') + + self._add_solvent_parameters(OPLS_params) + + return OPLS_params + + def _parse_parameters(self, path_to_parameters): + """ + It parses the parameters from ffld_server's output file. + + Parameters + ---------- + path_to_parameters : str + The path to the ffld_server's output file + + Returns + ------- + params : an OPLSParameters object + The set of lists of parameters grouped by parameter type. + Thus, the dictionary has the following keys: atom_names, + atom_types, charges, sigmas, and epsilons. + """ + params = defaultdict(list) + + with open(path_to_parameters) as f: + in_section = False + for line in f: + if line.startswith('OPLSAA FORCE FIELD TYPE ASSIGNED'): + in_section = True + + # Skip the next 3 lines + f.readline() + f.readline() + f.readline() + elif in_section: + if line.startswith('-'): + break + + fields = line.split() + assert len(fields) > 7, 'Unexpected number of fields ' \ + + 'found at line {}'.format(line) + + params['atom_names'].append(line[0:4]) + params['atom_types'].append(fields[3]) + params['charges'].append( + unit.Quantity(float(fields[4]), + unit.elementary_charge)) + params['sigmas'].append( + unit.Quantity(float(fields[5]), + unit.angstrom)) + params['epsilons'].append( + unit.Quantity(float(fields[6]), + unit.kilocalorie / unit.mole)) + + return self.OPLSParameters(params) + + def _add_solvent_parameters(self, OPLS_params): + """ + It add the solvent parameters to the OPLS parameters collection. + + Parameters + ---------- + OPLS_params : an OPLSParameters object + The set of lists of parameters grouped by parameter type. + Thus, the dictionary has the following keys: atom_names, + atom_types, charges, sigmas, and epsilons. The following + solvent parameters will be added to the collection: + """ + solvent_data = dict() + parameters_path = get_data_file_path('parameters/f14_sgbnp.param') + + with open(parameters_path) as f: + for line in f: + if line.startswith('#'): + continue + + fields = line.split() + assert len(fields) > 7, 'Unexpected line with less than ' \ + '8 fields at {}'.format(line) + + atom_type = fields[1] + + solvent_data[atom_type] = { + 'SGB_radii': unit.Quantity(float(fields[4]), + unit.angstrom), + 'vdW_radii': unit.Quantity(float(fields[5]), + unit.angstrom), + 'gammas': float(fields[6]), + 'alphas': float(fields[7])} + + parameters_to_add = defaultdict(list) + tried = list() + + for atom_type in OPLS_params['atom_types']: + parameters_found = False + while(not parameters_found): + if atom_type in solvent_data: + for label, value in solvent_data[atom_type].items(): + parameters_to_add[label].append(value) + parameters_found = True + + else: + new_atom_type = self._find_similar_atom_types(atom_type, + tried) + if new_atom_type is None: + atom_type = 'DF' # Set it to default + else: + tried.append(new_atom_type) + atom_type = new_atom_type + + for label, params in parameters_to_add.items(): + OPLS_params.add_parameters(label, params) + + def _find_similar_atom_types(self, atom_type, tried): + """ + It tries to find a similar atom type, skipping the ones that have + already been tried. It uses the definitions from the + similarity.param file. + + Parameters + ---------- + atom_type : str + The atom type from which similar atom types will be searched + tried : list[str] + The list of atom types that have already been tried and + will be skipped + + Returns + ------- + new_atom_type : str + The most similar atom type that has been found, if any. + Otherwise, it returns None + """ + + new_atom_type = None + best_similarity = 0 + similarity_path = get_data_file_path('parameters/similarity.param') + + with open(similarity_path) as f: + for line in f: + fields = line.split() + assert len(fields) > 2, 'Unexpected number of fields at ' \ + + 'line {}'.format(line) + + atom_type1, atom_type2, similarity = fields[0:3] + if (atom_type == atom_type1 + and float(similarity) > best_similarity + and atom_type2 not in tried): + best_similarity = float(similarity) + new_atom_type = atom_type2 + elif (atom_type == atom_type2 + and float(similarity) > best_similarity + and atom_type1 not in tried): + best_similarity = float(similarity) + new_atom_type = atom_type1 + + return new_atom_type + + class OPLSParameters(dict): + """ + OPLSParameters class that inherits from dict. + """ + + def __init__(self, parameters): + """ + It initializes an OPLSParameters object. + + parameters : dict + A dictionary keyed by parameter type + """ + for key, value in parameters.items(): + self[key] = value + + for params in self.values(): + assert len(params) == self.size, 'List of parameters must ' \ + 'be of the same length' + + def add_parameters(self, label, parameters): + """ + It adds a list of parameters of the same type to the collection. + + Parameters + ---------- + label : str + The label to describe the parameter type + parameters : list + The list of parameters to include to the collection. If + some parameters are already present, the newcomer list + must be of the same size as the ones already present in + the collection + """ + + if self.size: + assert len(parameters) == self.size, 'Expected list of ' \ + + 'parameters of the same size as the elements that ' \ + + 'are already in the collection' + + self[label] = parameters + + @property + def size(self): + if len(self) > 0: + return len(list(self.values())[0]) + else: + return None From dc0e087ca0046edd7cf5313f6fa181996513332c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Municoy?= Date: Fri, 28 Aug 2020 02:07:05 +0200 Subject: [PATCH 3/3] Update releasehistory.rst --- docs/releasehistory.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/releasehistory.rst b/docs/releasehistory.rst index fe689b6b..25305182 100644 --- a/docs/releasehistory.rst +++ b/docs/releasehistory.rst @@ -11,16 +11,21 @@ Releases follow the ``major.minor.micro`` scheme recommended by `PEP440 `_: Adds a new method to define a `Molecule` object through a SMILES tag. This molecule can be written as a PDB file later for PELE. +- `PR #31 `_: Adds the possibility to combine nonbonding and solvent parameters from OPLS2005 with bonding parameters from OFF. Bugfixes """""""" - `PR #22 `_: Fixes many bugs. For example, the default output name of the solvent parameters template is changed to `ligandParams.txt`, which is the name that PELE expects. +Tests added +""""""""""" +- `PR #31 `_: Adds tests to validate some functions of the new SchrodingerToolkitWrapper. + 0.2.1 -----