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

Implementation of the Martini3 Go-model #550

Merged
merged 102 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
8891cc5
init draft for Go model
fgrunewald Oct 6, 2023
ae818e3
first implementation Go model
fgrunewald Oct 8, 2023
d2ed0f6
implement structural bias processor
fgrunewald Oct 12, 2023
ab9303b
have some handy utilites for the Go pipeline
fgrunewald Oct 12, 2023
b315603
add water bias functionality
fgrunewald Oct 12, 2023
77d7c70
use new contact map format
fgrunewald Oct 12, 2023
96be469
rename get go
fgrunewald Oct 12, 2023
6e05c09
add licensce header
fgrunewald Oct 12, 2023
92fb9b9
move the go_vs_includes
fgrunewald Oct 12, 2023
462d033
add go_pipeline
fgrunewald Oct 12, 2023
01b617b
implement go_pipeline
fgrunewald Oct 12, 2023
f0bc07f
move logging to processor
fgrunewald Oct 12, 2023
1fd451a
lining
fgrunewald Oct 12, 2023
e60e120
refactor topology writing
fgrunewald Oct 13, 2023
e01dc30
some clean up
fgrunewald Oct 13, 2023
b0b4b6c
refactor water bias
fgrunewald Oct 16, 2023
5cd2c82
make water bias workflow worl
fgrunewald Oct 16, 2023
c7eb8c9
baseline for including tests
fgrunewald Oct 16, 2023
f7e4338
working Go flow
fgrunewald Oct 16, 2023
f06b290
contact map tes
fgrunewald Oct 16, 2023
7231e69
Merge branch 'Go' of https://github.com/marrink-lab/vermouth-martiniz…
fgrunewald Oct 16, 2023
257600a
test for reading and error in go map
fgrunewald Oct 16, 2023
4f45d81
test for go utils
fgrunewald Oct 16, 2023
0d7cc94
add test for atomtypes
fgrunewald Oct 16, 2023
90fca98
add test for atomtypes
fgrunewald Oct 16, 2023
31fa775
change name test atomtypes
fgrunewald Oct 16, 2023
b96113e
add tests nonbond_params
fgrunewald Oct 16, 2023
6f59271
fix comment handling
fgrunewald Oct 16, 2023
7e11ddc
use resid function from go_utils
fgrunewald Oct 16, 2023
c072b92
idot safe in resid handling
fgrunewald Oct 16, 2023
cba5f78
update dummy molecule
fgrunewald Oct 16, 2023
7fc412d
topology writing test
fgrunewald Oct 17, 2023
f368a38
do writing test in tmp dir
fgrunewald Oct 17, 2023
82ca6af
address comment in topology file writing
fgrunewald Oct 17, 2023
af6de49
update doc-string
fgrunewald Oct 17, 2023
403ec92
test-water bias
fgrunewald Oct 17, 2023
8ed3e84
refactor water bias test
fgrunewald Oct 17, 2023
f4f97a9
fix go processor chain accounting
fgrunewald Oct 17, 2023
65106b0
test for go processor structure bias
fgrunewald Oct 17, 2023
fbbf8f5
fix indent in vs creator
fgrunewald Oct 17, 2023
71a8d2e
fix some more issues
fgrunewald Oct 17, 2023
cae03e9
adjust test to skip no OV/rCSU contacts
fgrunewald Oct 17, 2023
f01261b
remove debug
fgrunewald Oct 17, 2023
293b73e
add test for symmetric contact
fgrunewald Oct 17, 2023
c87d245
VirtualSideCreator to VirtualSiteCreator
Lp0lp Oct 19, 2023
662ecfa
Moved create_sys_all_attrs to helperfunctions
Lp0lp Oct 19, 2023
56c87bb
move test_molecule to helper_functions
Lp0lp Oct 19, 2023
0056f7f
More fixes
Lp0lp Oct 19, 2023
6ee5107
Merge pull request #555 from Lp0lp/Go
fgrunewald Oct 19, 2023
7a85e44
Keep only symmetrical go contacts.
Lp0lp Oct 20, 2023
7adc157
Fix go_struct_bias tests & add some more.
Lp0lp Oct 20, 2023
6e361d2
use _old_resid in water bias for identifying ID regions
fgrunewald Oct 23, 2023
7f00195
add nx to go_pipeline
fgrunewald Oct 23, 2023
82df118
use _old_resid in structure bias for finding the atomtype
fgrunewald Oct 23, 2023
47cf186
Merge branch 'Go' of https://github.com/marrink-lab/vermouth-martiniz…
fgrunewald Oct 23, 2023
546ac15
Merge branch 'master' into Go
fgrunewald Oct 25, 2023
28359a0
test self interaction nb params
fgrunewald Oct 27, 2023
3182111
add tests for high level errors in water generatoin
fgrunewald Nov 1, 2023
24662f8
remove unneccesary post_section_lines feature
fgrunewald Nov 1, 2023
2f48e61
radd calls to super for run_system
fgrunewald Nov 1, 2023
2b5853c
radd calls to super for run_system
fgrunewald Nov 1, 2023
01483d4
Apply suggestions from code review
fgrunewald Nov 3, 2023
23323a3
properly implement renaming of convert_sigma_to_epsilon
fgrunewald Nov 3, 2023
e535717
add test for go utilitz error
fgrunewald Nov 3, 2023
54ba9d9
more tests
fgrunewald Nov 3, 2023
f66d202
more tests water bias
fgrunewald Nov 3, 2023
7d0727e
fix docstring
fgrunewald Nov 3, 2023
e3cf4ad
loop over lines from buffer when reading contact map
fgrunewald Nov 3, 2023
a1c52ba
address some comments
fgrunewald Nov 3, 2023
bd785f4
fix docstring
fgrunewald Nov 3, 2023
cb223e5
Added go suport in tests. First GO integ test.
Nov 23, 2023
89c292d
Added more integ tests.
Nov 23, 2023
9f4cb17
use -go for map parsing
fgrunewald Nov 30, 2023
911b3a6
fix docs
fgrunewald Nov 30, 2023
23138d6
Update vermouth/processors/water_bias.py
fgrunewald Dec 5, 2023
f31201b
Update vermouth/processors/water_bias.py
fgrunewald Dec 5, 2023
486c13e
Update martinize2_workflow.rst
fgrunewald Dec 5, 2023
b6ca0a1
add doi for c-code
fgrunewald Dec 5, 2023
1699276
fix docs according to new go
fgrunewald Dec 5, 2023
507b36c
Merge branch 'master' into Go
fgrunewald Dec 5, 2023
dacbdf8
Create __init__.py
fgrunewald Dec 5, 2023
6e8382d
Update contact_map.py
fgrunewald Dec 5, 2023
806d1f5
Fix sphinx references
pckroon Dec 5, 2023
6f0f20b
Fix sphinx references
pckroon Dec 5, 2023
0f31eed
fix CLI typo
pckroon Dec 6, 2023
71f19aa
Update bin/martinize2
fgrunewald Dec 6, 2023
317f813
Apply suggestions from code review
fgrunewald Dec 11, 2023
484f904
Apply suggestions from code review
fgrunewald Dec 11, 2023
372f226
Apply suggestions from code review
fgrunewald Dec 11, 2023
01b32b5
Update vermouth/tests/rcsu/test_go_utils.py
fgrunewald Dec 14, 2023
023e457
Update vermouth/tests/helper_functions.py
fgrunewald Dec 14, 2023
cf40022
Update vermouth/tests/rcsu/test_go_structure_bias.py
fgrunewald Dec 14, 2023
aaf8ee2
Update vermouth/tests/integration_tests/test_integration.py
fgrunewald Dec 14, 2023
69ae011
Update vermouth/tests/integration_tests/test_integration.py
fgrunewald Dec 14, 2023
393e1bb
put comment
fgrunewald Dec 14, 2023
72a3817
fix docstring go vs includes
fgrunewald Dec 14, 2023
e2491d0
fix spelling
fgrunewald Dec 14, 2023
012c1c9
Merge branch 'master' into Go
pckroon Dec 14, 2023
2a36e63
make itp_paths dict in write_gmx_topology
fgrunewald Dec 14, 2023
daa792b
fix error type in test
fgrunewald Dec 14, 2023
f5f5dea
fix bug in topology regarding itp_paths
fgrunewald Dec 14, 2023
2fb2821
fix bug in topology regarding itp_paths
fgrunewald Dec 14, 2023
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
63 changes: 61 additions & 2 deletions bin/martinize2
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ from vermouth.map_input import (
generate_all_self_mappings,
combine_mappings,
)
from vermouth.rcsu.contact_map import read_go_map
from vermouth.rcsu.get_go import GetGo
from vermouth.citation_parser import citation_formatter

# TODO Since vermouth's __init__.py does some logging (KDTree), this may or may
Expand Down Expand Up @@ -618,16 +620,60 @@ def entry():
)
go_group = parser.add_argument_group("Virtual site based GoMartini")
go_group.add_argument(
"-govs-includes",
"-go",
action="store_true",
default=False,
help="Write include statements to use Vitrual Site Go Martini.",
help="Apply the Martini Go model as structural bias.",
)
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
go_group.add_argument(
"-govs-moltype",
dest="govs_moltype",
default="molecule_0",
help=("Set the name of the molecule when using " "Virtual Sites GoMartini."),
)
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
go_group.add_argument(
"-govs-includes",
action="store_true",
default=False,
help="Write include statements to use Vitrual Site Go Martini.",
)
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
go_group.add_argument(
"-govs-map",
dest="go_map",
required=False,
type=Path,
default=False,
help="Write include statements to use Vitrual Site Go Martini.",
)
go_group.add_argument(
"-govs-low",
dest="go_low",
type=float,
default=0.3,
help=("Set the name of the molecule when using " "Virtual Sites GoMartini."),
)
go_group.add_argument(
"-govs-up",
dest="go_up",
type=float,
default=1.1,
help=("Set the name of the molecule when using " "Virtual Sites GoMartini."),
)
go_group.add_argument(
"-govs-eps",
dest="go_eps",
type=float,
default=0.0,
help=("Set the name of the molecule when using " "Virtual Sites GoMartini."),
)
go_group.add_argument(
"-govs-res-dist",
dest="go_res_dist",
type=int,
default=3,
help=("Set the name of the molecule when using " "Virtual Sites GoMartini."),
)
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved

prot_group = parser.add_argument_group("Protein description")
prot_group.add_argument(
"-scfix",
Expand Down Expand Up @@ -977,8 +1023,21 @@ def entry():
"The output topology will require files generated by " '"create_goVirt.py".'
)
vermouth.MergeAllMolecules().run_system(system)
# not ideal but we need it before making the Go sides
res_graph = vermouth.graph_utils.make_residue_graph(system.molecules[0])
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
vermouth.SetMoleculeMeta(moltype=args.govs_moltype).run_system(system)
vermouth.GoVirtIncludes().run_system(system)
LOGGER.info("Reading Go model contact map.")
go_map = read_go_map(args.go_map)
LOGGER.info("Computing Go interaction table.")
GetGo(contact_map=go_map,
cutoff_short=args.go_low,
cutoff_long=args.go_up,
go_eps=args.go_eps,
res_dist=args.go_res_dist,
prefix=args.govs_moltype,
res_graph=res_graph,
).run_system(system)
defines = ("GO_VIRT",)
else:
# Merge chains if required.
Expand Down
42 changes: 42 additions & 0 deletions vermouth/rcsu/contact_map.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2023 University of Groningen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Read RCSU Go model contact maps.
"""

def read_go_map(file_path, header_lines=0, cols=[2, 6, 10]):
"""
Read a RCSU contact map.
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
"""
with open(file_path, "r", encoding='UTF-8') as _file:
lines = _file.readlines()

Check warning on line 24 in vermouth/rcsu/contact_map.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/contact_map.py#L24

Added line #L24 was not covered by tests
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved

contacts = []
read = False

Check warning on line 27 in vermouth/rcsu/contact_map.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/contact_map.py#L26-L27

Added lines #L26 - L27 were not covered by tests
for line in lines:
tokens = line.strip().split()

Check warning on line 29 in vermouth/rcsu/contact_map.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/contact_map.py#L29

Added line #L29 was not covered by tests
if len(tokens) == 0:
continue

Check warning on line 31 in vermouth/rcsu/contact_map.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/contact_map.py#L31

Added line #L31 was not covered by tests
# we start parsing
# using R1 is super flaky but I don't see a good way to identify
# when the contact map starts ...
if tokens[0] == "R1":
read = True

Check warning on line 36 in vermouth/rcsu/contact_map.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/contact_map.py#L36

Added line #L36 was not covered by tests
elif read:
# a contact consits of a resid and the chain ID
contacts.append((int(tokens[1]), tokens[2], int(tokens[4]), tokens[5]))

Check warning on line 39 in vermouth/rcsu/contact_map.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/contact_map.py#L39

Added line #L39 was not covered by tests
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
else:
continue
return contacts

Check warning on line 42 in vermouth/rcsu/contact_map.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/contact_map.py#L41-L42

Added lines #L41 - L42 were not covered by tests
164 changes: 164 additions & 0 deletions vermouth/rcsu/get_go.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Copyright 2023 University of Groningen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Process the Go contact pairs.
"""
import numpy as np
import networkx as nx
from vermouth.molecule import Interaction

def _get_bb_nodes(molecule, nodes):
for node in nodes:
if molecule.nodes[node]['atomname'] == "BB":
return node
return None

Check warning on line 25 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L24-L25

Added lines #L24 - L25 were not covered by tests
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved

def _get_go_type(molecule, resid, chain, prefix):
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
for node in molecule.nodes:
attrs = molecule.nodes[node]

Check warning on line 29 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L29

Added line #L29 was not covered by tests
if attrs['resid'] == resid and attrs['chain'] == chain:
if prefix in attrs['atype']:
return attrs['atype']
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
raise IOError(f"Could not find GoVs with resid {resid} in chain {chain}.")

Check warning on line 33 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L32-L33

Added lines #L32 - L33 were not covered by tests

def _in_region(resid, regions):
"""
Check if resid falls in regions interval.
"""
for low, up in regions:
if low <= resid <= up:
return True
return False

Check warning on line 42 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L41-L42

Added lines #L41 - L42 were not covered by tests

class GetGo():
"""
Generate the Go model interaction parameters.
"""
def __init__(self,
contact_map,
cutoff_short,
cutoff_long,
go_eps,
res_dist,
res_graph,
regions=None,
water_bias=None,
idp_water_bias=None,
prefix="VS"):

self.contact_map = contact_map
self.cutoff_short = cutoff_short
self.cutoff_long = cutoff_long
self.go_eps = go_eps
self.res_dist = res_dist
self.itp_file = open('GoVirtIncludes.itp', "w", encoding='UTF-8')
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
self.prefix = prefix
self.res_graph = res_graph
self.water_bias = water_bias
self.idp_water_bias = idp_water_bias
self.regions = regions

Check warning on line 70 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L60-L70

Added lines #L60 - L70 were not covered by tests

def write_go_structural_bias(self, molecule):
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
chain_id_to_resnode = {}

Check warning on line 73 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L73

Added line #L73 was not covered by tests
# find all pairs of residues that are within bonded distance of
# self.res_dist
connected_pairs = dict(nx.all_pairs_shortest_path_length(self.res_graph,

Check warning on line 76 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L76

Added line #L76 was not covered by tests
cutoff=self.res_dist))

# for each residue collect the chain and residue in a dict
# we use this later for identifying the residues from the
# contact map
for resnode in self.res_graph.nodes:
chain = self.res_graph.nodes[resnode].get('chain', None)

Check warning on line 83 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L83

Added line #L83 was not covered by tests
# in vermouth within a molecule all resid are unique
# when merging multiple chains we store the old resid
# the go model always references the input resid i.e.
# the _old_resid
resid = self.res_graph.nodes[resnode].get('_old_resid')
chain_id_to_resnode[(chain, resid)] = resnode

Check warning on line 89 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L88-L89

Added lines #L88 - L89 were not covered by tests

for contact in self.contact_map:
resIDA, chainA, resIDB, chainB = contact

Check warning on line 92 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L92

Added line #L92 was not covered by tests
# identify the contact in the residue graph based on
# chain ID and resid
resA = chain_id_to_resnode[(chainA, resIDA)]
resB = chain_id_to_resnode[(chainB, resIDB)]

Check warning on line 96 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L95-L96

Added lines #L95 - L96 were not covered by tests
# make sure that both residues are not connected
# note: contacts should be symmteric so we should be
# able to get rid of the second if clause
if resB not in connected_pairs[resA] and resA not in connected_pairs[resB]:
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
# now we lookup the backbone nodes within the residue contact
bb_node_A = _get_bb_nodes(molecule, self.res_graph.nodes[resA]['graph'].nodes)
bb_node_B = _get_bb_nodes(molecule, self.res_graph.nodes[resB]['graph'].nodes)

Check warning on line 103 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L102-L103

Added lines #L102 - L103 were not covered by tests
# compute the distance between bb-beads
dist = np.linalg.norm(molecule.nodes[bb_node_A]['position'] -

Check warning on line 105 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L105

Added line #L105 was not covered by tests
molecule.nodes[bb_node_B]['position'])
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
# verify that the distance between BB-beads satisfies the
# cut-off criteria
if dist > self.cutoff_short or dist < self.cutoff_long:
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
# compute the LJ sigma paramter for this contact
sigma = dist / 1.12246204830

Check warning on line 111 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L111

Added line #L111 was not covered by tests
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
# find the go virtual-sites for this residue
# probably can be done smarter but mehhhh
nodeA = _get_go_type(molecule, resid=resIDA, chain=chainA, prefix=self.prefix)
nodeB = _get_go_type(molecule, resid=resIDB, chain=chainB, prefix=self.prefix)

Check warning on line 115 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L114-L115

Added lines #L114 - L115 were not covered by tests
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
# write itp file with go interaction parameters
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
self.itp_file.write(f"{nodeA} {nodeB} 1 {sigma:3.8F} {self.go_eps:3.8F} ; structural Go bias\n")

Check warning on line 117 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L117

Added line #L117 was not covered by tests
# generate the exclusions between pairs of bb beads
excl = Interaction(atoms=(bb_node_A, bb_node_B), parameters=[], meta={"group": "Go model exclusion"})
molecule.interactions['exclusions'].append(excl)

Check warning on line 120 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L119-L120

Added lines #L119 - L120 were not covered by tests

def write_water_bias_auto(self, molecule):
"""
Automatically calculate the water bias depending on the secondary structure.
"""
self.itp_file.write('; additional Lennard-Jones interaction between virtual BB bead and W\n')

Check warning on line 126 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L126

Added line #L126 was not covered by tests
for res_node in self.res_graph.nodes:
resid = self.res_graph.nodes[res_node]['resid']
chain = self.res_graph.nodes[res_node]['chain']
vs_go_node = _get_go_type(molecule, resid=resid, chain=chain, prefix=self.prefix)
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
sec_struc = self.res_graph.nodes[res_node]['sec_struc']
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
eps = self.water_bias.get(sec_struc, 0.0)

Check warning on line 132 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L128-L132

Added lines #L128 - L132 were not covered by tests
if self.res_graph.nodes[res_node]['resname'] in ['GLY', 'ALA', 'VAL', 'PRO']:
sigma = 0.430

Check warning on line 134 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L134

Added line #L134 was not covered by tests
else:
sigma = 0.470

Check warning on line 136 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L136

Added line #L136 was not covered by tests
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved

self.itp_file.write(f"W {vs_go_node} 1 {sigma:3.8F} {eps:3.8F} ; secondary structure water bias\n")

Check warning on line 138 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L138

Added line #L138 was not covered by tests

def write_water_bias_idr(self, molecule):
fgrunewald marked this conversation as resolved.
Show resolved Hide resolved
"""
Write bias for intrinsically disordered domains from manual selection.
"""
self.itp_file.write('; additional Lennard-Jones interaction between virtual BB bead and W\n')

Check warning on line 144 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L144

Added line #L144 was not covered by tests
for res_node in self.res_graph.nodes:
if _in_region(self.res_graph.nodes[res_node], self.regions):
resid = self.res_graph.nodes[res_node]['resid']
chain = self.res_graph.nodes[res_node]['chain']
vs_go_node = _get_go_type(molecule, resid=resid, chain=chain, prefix=self.prefix)
eps = self.idp_water_bias

Check warning on line 150 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L147-L150

Added lines #L147 - L150 were not covered by tests
if self.res_graph.nodes[res_node]['resname'] in ['GLY', 'ALA', 'VAL', 'PRO']:
sigma = 0.430

Check warning on line 152 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L152

Added line #L152 was not covered by tests
else:
sigma = 0.470

Check warning on line 154 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L154

Added line #L154 was not covered by tests

self.itp_file.write(f"W {vs_go_node} 1 {sigma:3.8F} {eps:3.8F} ; idp water bias\n")

Check warning on line 156 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L156

Added line #L156 was not covered by tests

def run_system(self, system):
for molecule in system.molecules:
self.write_go_structural_bias(molecule)

Check warning on line 160 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L160

Added line #L160 was not covered by tests
if self.water_bias:
self.write_water_bias_auto(self, molecule)

Check warning on line 162 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L162

Added line #L162 was not covered by tests

self.itp_file.close()

Check warning on line 164 in vermouth/rcsu/get_go.py

View check run for this annotation

Codecov / codecov/patch

vermouth/rcsu/get_go.py#L164

Added line #L164 was not covered by tests