Skip to content
Draft
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
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ rmgweb/media/rmg/tools/*
.pydevproject
.settings/*

# WSGI
apache/django.wsgi

# VS Code related files
.history/*

Expand Down
18 changes: 9 additions & 9 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# First, install a conda environment with RMG-Py.
# Then, update the environment using the constraints in this environment file.

name: rmg_env
name: rmg_website
channels:
- rmg
- conda-forge
- cantera
- simonabuzzi
- fhvermei
dependencies:
- docutils
- django =2.2
- lxml
- django==4.2
- pip
- pip:
- git+https://github.com/bp-kelley/[email protected]
- python >=3.7
- solprop_ml >=1.2
- git+https://github.com/bp-kelley/descriptastorus
- simonabuzzi::solprop_ml_mix
- wandb # Required for solprop_ml_mix
- python>=3.9
- xlsxwriter
- fhvermei::chemprop_solvation
- cantera==2.6.0*

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions rmgweb/database/templates/kineticsTable.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@
var treeChildren = new Array();

{% for entry in entries %}
{% ifequal entry.parent None %}
{% if entry.parent == None %}
treeParent["{{ entry.index }}"] = "";
{% else %}
treeParent["{{ entry.index }}"] = "{{ entry.parent.index }}";
{% endifequal %}
{% endif %}
treeChildren["{{ entry.index }}"] = [{% for child in entry.children %}"{{ child.index }}"{% if not forloop.last %}, {% endif %}{% endfor %}];
{% endfor %}

Expand Down
4 changes: 2 additions & 2 deletions rmgweb/database/templates/thermoEntry.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ <h2>Structure</h2>
</p>

<h2>Thermodynamic Data</h2>
{% ifequal thermo.0 'Link' %}
{% if thermo.0 == 'Link' %}
<table class="thermoEntryData">
<tr>
<td class="key">Link:</td>
Expand All @@ -98,7 +98,7 @@ <h2>Thermodynamic Data</h2>
</table>
{% else %}
{{ thermo|render_thermo_math:user }}
{% endifequal %}
{% endif %}

{% if nasa_string %}
<br/>
Expand Down
1 change: 0 additions & 1 deletion rmgweb/database/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ def generateReactions(database, reactants, products=None, only_families=None, re
reactants, products, only_families=only_families, resonance=resonance)
if len(reactants) == 1:
# if only one reactant, react it with itself bimolecularly, with RMG-py
# the java version already does this (it includes A+A reactions when you react A)
reactants2 = [reactants[0], reactants[0]]
reaction_list.extend(database.kinetics.generate_reactions(
reactants2, products, only_families=only_families, resonance=resonance))
Expand Down
346 changes: 136 additions & 210 deletions rmgweb/database/views.py

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions rmgweb/main/migrations/0002_alter_userprofile_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.2.23 on 2025-07-03 15:10

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("main", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name="userprofile",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
]
2 changes: 1 addition & 1 deletion rmgweb/main/templatetags/render_solvation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from rmgpy.data.base import Entry
from rmgpy.species import Species
from rmgpy.molecule.group import Group
from rmgpy.data.solvation import *
from rmgpy.data.solvation import SoluteData, SolventData, SolvationCorrection

# Register this module as a Django template tag library
register = template.Library()
Expand Down
47 changes: 26 additions & 21 deletions rmgweb/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
from django.urls import reverse
from django.views.decorators.csrf import csrf_exempt

from rmgpy.molecule.group import Group
from rmgpy.molecule.adjlist import InvalidAdjacencyListError

from rmgpy.molecule.atomtype import allElements as SUPPORTED_ELEMENTS

from rmgweb.main.forms import *
Expand All @@ -68,6 +71,10 @@
elif len(element) == 2:
SUPPORTED_ELEMENTS_TWO_LETTERS.append(element)

# add conda environment bin to PATH. Added on 3 July 2025 to ensure graphviz is added to path, even if bashrc is not sourced.
bin = os.path.join(os.environ.get("CONDA_PREFIX", ""), "bin")
if bin and bin not in os.environ["PATH"]:
os.environ["PATH"] = bin + os.pathsep + os.environ["PATH"]

def index(request):
"""
Expand Down Expand Up @@ -354,30 +361,28 @@ def drawGroup(request, adjlist, format='png'):
Returns an image of the provided adjacency list `adjlist` for a molecular
group. urllib is used to quote/unquote the adjacency list.
"""
from rmgpy.molecule.group import Group
from rmgpy.molecule.adjlist import InvalidAdjacencyListError

adjlist = urllib.parse.unquote(adjlist)

# try:
# group = Group().from_adjacency_list(adjlist)
# except (InvalidAdjacencyListError, ValueError):
# response = HttpResponseRedirect(static('img/invalid_icon.png'))
# else:
# if format == 'png':
# response = HttpResponse(content_type="image/png")
# response.write(group.draw('png'))
# elif format == 'svg':
# response = HttpResponse(content_type="image/svg+xml")
# svg_data = group.draw('svg')
# # Remove the scale and rotate transformations applied by pydot
# svg_data = re.sub(r'scale\(0\.722222 0\.722222\) rotate\(0\) ', '', svg_data)
# response.write(svg_data)
# else:
# response = HttpResponse('Image format not implemented.', status=501)

# return response
return HttpResponse(content_type="image/png") # TODO: fix root cause. Added 3/31/25 as a stopgap to prevent 'neato not found' errors.
try:
group = Group().from_adjacency_list(adjlist)
except (InvalidAdjacencyListError, ValueError):
response = HttpResponseRedirect(static('img/invalid_icon.png'))
else:
if format == 'png':
response = HttpResponse(content_type="image/png")
response.write(group.draw('png'))
elif format == 'svg':
response = HttpResponse(content_type="image/svg+xml")
svg_data = group.draw('svg')
# Remove the scale and rotate transformations applied by pydot
svg_data = re.sub(r'scale\(0\.722222 0\.722222\) rotate\(0\) ', '', svg_data)
response.write(svg_data)
else:
response = HttpResponse('Image format not implemented.', status=501)

return response
# return HttpResponse(content_type="image/svg+xml")


@login_required
Expand Down
3 changes: 2 additions & 1 deletion rmgweb/pdep/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def getDirname(self):
Return the absolute path of the directory that the Network object uses
to store files.
"""
return os.path.join(settings.MEDIA_ROOT, 'pdep', 'networks', str(self.pk))
pk_str = self.pk.decode() if isinstance(self.pk, bytes) else str(self.pk)
return os.path.join(settings.MEDIA_ROOT, 'pdep', 'networks', pk_str)

def getInputFilename(self):
"""
Expand Down
Loading