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

Improved behavior of adding water box with a specified shape #31

Merged
merged 1 commit into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 4 additions & 14 deletions openmmsetup/openmmsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from flask import Flask, request, session, g, render_template, make_response, send_file, url_for
from werkzeug.utils import secure_filename
from multiprocessing import Process, Pipe
from math import sqrt
import datetime
import os
import shutil
Expand Down Expand Up @@ -241,25 +240,16 @@ def addHydrogens():
pH = float(request.form.get('ph', '7'))
fixer.addMissingHydrogens(pH)
if 'addWater' in request.form:
padding, boxSize, boxVectors = None, None, None
padding, boxSize, boxShape = None, None, None
if request.form['boxType'] == 'geometry':
geompadding = float(request.form['geomPadding']) * unit.nanometer
geometry = request.form['geometryDropdown']
maxSize = max(max((pos[i] for pos in fixer.positions))-min((pos[i] for pos in fixer.positions)) for i in range(3))
if geometry == 'cube':
padding = geompadding
elif geometry == 'truncatedOctahedron':
vectors = mm.Vec3(1,0,0), mm.Vec3(1/3,2*sqrt(2)/3,0), mm.Vec3(-1/3,sqrt(2)/3,sqrt(6)/3)
boxVectors = [(maxSize+geompadding)*v for v in vectors]
elif geometry == 'rhombicDodecahedron':
vectors = mm.Vec3(1,0,0), mm.Vec3(0,1,0), mm.Vec3(0.5,0.5,sqrt(2)/2)
boxVectors = [(maxSize+geompadding)*v for v in vectors]
padding = float(request.form['geomPadding']) * unit.nanometer
boxShape = request.form['geometryDropdown']
else:
boxSize = (float(request.form['boxx']), float(request.form['boxy']), float(request.form['boxz']))*unit.nanometer
ionicStrength = float(request.form['ionicstrength'])*unit.molar
positiveIon = request.form['positiveion']+'+'
negativeIon = request.form['negativeion']+'-'
fixer.addSolvent(boxSize, padding, boxVectors, positiveIon, negativeIon, ionicStrength)
fixer.addSolvent(boxSize=boxSize, padding=padding, boxShape=boxShape, positiveIon=positiveIon, negativeIon=negativeIon, ionicStrength=ionicStrength)
elif 'addMembrane' in request.form:
lipidType = request.form['lipidType']
padding = float(request.form['membranePadding'])*unit.nanometer
Expand Down
6 changes: 3 additions & 3 deletions openmmsetup/templates/addHydrogens.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h2>Add Water/Membrane</h2>
</div>
</div>
<div id="paddedBoxDimensions">
The largest dimension of the model (along the x, y, or z axis) will be determined, and the specified padding will be added to each edge of the box.
The diameter of a sphere containing the model will be determined, and the specified padding will be added to it.
<div class="form-group">
<label class="control-label col-md-3">Padding Distance (nm)</label>
<div class="col-md-9"><input type="text" id="geomPadding" name="geomPadding" class="form-control" value="1.0"></div>
Expand All @@ -57,8 +57,8 @@ <h2>Add Water/Membrane</h2>
<div class="col-md-9">
<select id="geometryDropdown" name="geometryDropdown" class="form-control">
<option value="cube" selected="selected">Cube</option>
<option value="truncatedOctahedron">Truncated octahedron</option>
<option value="rhombicDodecahedron">Rhombic dodecahedron</option>
<option value="octahedron">Truncated octahedron</option>
<option value="dodecahedron">Rhombic dodecahedron</option>
</select>
</div>
</div>
Expand Down