Skip to content

Commit

Permalink
add warning, fix tutorial
Browse files Browse the repository at this point in the history
the random flag of convert shouldnt be used with gaussian linker domains
added a warning (just a print message) removed this flag from the
tutorial...
  • Loading branch information
Patrick Quoika committed Mar 15, 2022
1 parent c43c9ca commit 4353220
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
11 changes: 9 additions & 2 deletions pycomplexes/pycomplexes/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,12 @@ def __init__(self, node, name, randomize=False, box=None):

# guess connections for gaussian domains
guessed_connections = []
flag_linkers_plus_random_placement=False
for dom in self.domains:
n = dom.node
if dom.type == "gaussian":
if randomize:
flag_linkers_plus_random_placement=True
start_atom = u.select_atoms(n["start_connection"][1])
if start_atom.n_atoms != 1:
raise RuntimeError(
Expand All @@ -287,7 +290,11 @@ def __init__(self, node, name, randomize=False, box=None):
}
guessed_connections.append(con3)
dom._metadata['connection_id'] = len(guessed_connections) - 1

if flag_linkers_plus_random_placement:
print("WARNING: You used the randomized starting position in combination with Gaussian linker domains!")
print("The random placement does not respect the distance restraints, " +
"which are implied by the Gaussian linker domains")
print("We strongly recommend not to combine random initial placement with Gaussian Linker domains!")

# update connections
connections = node.get("connections", dict())
Expand Down Expand Up @@ -477,7 +484,7 @@ def parser(p):
p.add_argument("--debye_length", type=float, default=10)
p.add_argument("--dielectric_constant", type=float, default=80)
p.add_argument(
"--random", type=bool, help="random placement of the topologies in the box"
"--random", action="store_true", help="random placement of the topologies in the box"
)
p.add_argument(
"--list_forcefields",
Expand Down
13 changes: 2 additions & 11 deletions tutorials/Linker/chmp3_simulations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"outputs": [],
"source": [
"%%writefile chmp3.top\n",
"box: [100, 100, 100]\n",
"box: [200, 200, 200]\n",
"topology:\n",
" CHMP3:\n",
" coordinate-file: chmp3.pdb\n",
Expand Down Expand Up @@ -59,7 +59,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pycomplexes convert chmp3.top chmp3.cplx --random=True"
"!pycomplexes convert chmp3.top chmp3.cplx"
]
},
{
Expand Down Expand Up @@ -126,15 +126,6 @@
"!pycomplexes visualize -cc config.yaml"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"pwd"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 4353220

Please sign in to comment.