aerkiaga's blog

Progress report on my projects

Well, I did it. I got accepted by Open Chemistry and Google to officially work on Avogadro 2's biomolecular support. See this Discourse post to learn more and add your own ideas. I'll be (and have started!) working on the following:

  • Adding the ability to create molecular surfaces (Van der Waals, solvent accessible and excluded), colored by at least one scheme (e.g. electron density, hydrophobicity, partial charge...).
  • Adding support for rendering non-covalent interactions, like close contacts, hydrogen bonds, etc.
  • Making Avogadro 2 able to handle coordination complexes gracefully.
  • Fixing issues affecting bioinformatics workflows and improving performance in that area.

Additionally, I've cleaned the dust off Nodeverse and finished the latest piece of infrastructure: a set of scripts to convert OpenSCAD files into .obj!

I've just added automatic UV map generation and better handling of non-rectangular faces. Note that the scripts are only designed to work with axis-aligned faces (which are the only ones I'm using in Nodeverse, by design), but now at least they can have any shape within that constraint.

The idea is to use these new tools to ease development of models for the nv_ships mod, part of Nodeverse.

I did quite a lot of learning last week around molecular dynamics and quantum mechanics. In fact, I managed to get GROMACS, CP2K and OpenBabel working together to give accurate predictions on the density and heat of vaporization of various substances.

I sent a small PR to Avogadro 2, advanced in the design of both the Big Project and the tomograph, printed a piece of the latter... But I've got an exam today, in a few hours, and I've barely touched the subject :)

The more I study about Medicine, the more I see what's missing from it. And the less I think I know about the field... So massive...

For example, why don't medical records leverage Open Source Software? Why aren't EKG and other devices generally available on the cheap? Why do all imaging tests have pitfalls preventing their massive use? Why is AI not assisting imaging techniques yet? Why isn't there pharmacological secondary prevention for cancer? Why are tisular force equilibria so under-researched if they are so important? Why is the surgical field physically open to air? Why are GMO bacteria taking so long to be part of microbiome-targeting therapies?

I should probably stop wishing and keep studying. Somebody will eventually research the above after all, but no one can do my exam for me!

All the electronic components are here! I used aerkiaga/fluidics to 3D-print three boards out of ABS. Unfortunately, my printer can't add copper vias, so it's basically a matter of putting components in place, then soldering them on the other side, connecting them with tiny wires. Gross, but it works. So far I've made:

  • A small 9V barrel jack connector breakout board.
  • A 9V to 28V boost converter, to power the sensor.
  • An ESP32 board. Honestly I'm still soldering it, and there's a catch...

... one of the components is in a tiny QFN form factor chip that I still don't feel confident enough to put my soldering iron on. I soldered something that small before, but ended up overheating it (plus I bent or ripped a few pins and then dipped the whole thing in a non-electronics-safe cleaning bath... yeah...).


I've sent a couple more PRs to Avogadro 2:

  • #878: rewrites and finishes the subgraph detection code.
  • #887: fixes a few unimportant Valgrind errors so this kind of testing can be automated in the future.

I'm also learning to make biomolecular simulations using GROMACS. No new use-cases of that knowledge for now, but I hope to do something about this in the near future ;)

This week, I made some to the Avogadro 2 codebase. A few PRs were merged:

  • #860, which accelerates cartoon rendering.
  • #862 is the first step towards some big summer time changes!
  • #868 adds a new plugin, you might see it under 'View' –> 'Focus Selection' and 'View' –> 'Unfocus'.

I've already made a few orders for many electronic pieces (lots of $$). Plus I'm designing the code even further. It's a little weird writing the actual code while drafting these designs, but I hope the extra thought put into it will pay off.

I started last week getting angry at CadQuery's install procedure, which seems to be all of unreliable, bloated and proprietary. Disenchanted with OpenSCAD's lack of speed, I set off to write CaSCAD, which is little more than an OpenSCAD clone laid on top of Open Cascade Technology (OCCT).

Problem is, it's also laid on top of GTK4 (because why not), and I've not managed to get OCCT and GTK4 working together. Probably because my distro doesn't offer GTK4 natively; or maybe because some assumptions are made about what uses OpenGL and what uses GLES. In any way, that little burst of energy ended there, after having a full OpenSCAD parser, a partial compiler and bytecode interpreter, a stub of an OCCT backend and a nice-looking but empty GUI (with syntax highlighting). But not before scanning the OCCT codebase for any possible OpenGL bug...


I spent this week drafting a new device. Something that I intend to present to my professors to hopefully get my degree project managed around it. Something that can see inside the body, using...

Lasers. I bought three of them, each emitting in a different wavelength and with a different power (don't worry, no class 4). I intend to collimate them myself, using epoxy lenses, and then guide them with acrylic beam splitters.

An engineering student friend asked me if I could somehow get Cura to control the über-expensive titanium printer he was using, to break free from the half-baked commercial solution they only had available. Fast-forward a day and there's a Cura profile and post-processing script in his inbox, so now he'll design the mechanisms for my upcoming medical laser-bearing machine :)


I've also made great progress with my Big Project. First, the bad news: I haven't managed to inject metal into 3D prints... But the good news is, I don't need to. With the updated fluidics tools, I can just use a frying pan as a low-temp reflow oven and solder everything with Rose's metal!

I've also researched the electronics part of it, and am about to order large amounts of electronics components: ESP32 modules, stepper drivers, MOSFETs, frequency synthesis circuitry...

Finally, I've written some more of the code for this project. In case you're new to this blog, I'm coding everything in Rust, to make sure it's safe for biomedical applications. But here's something new...

The code is made of a client, a server/daemon, a real-time multitasking exokernel and a Hardware Abstraction Layer (HAL) underneath it. Right now, I'm making a “virtual” HAL that just runs the kernel on the host machine, using pipes to communicate with the daemon. This should help debug issues in the future, set up CI workflows, etc.

This week, I reimagined my fluidics tools. Rather than a complete solution, they were redone to work with other programs, so now you can simply draw a circuit in KiCAD and make it into an OpenSCAD script.

Of course, that leads us to OpenSCAD. No matter how much I love this tool, I feel it needs improvements. In particular, it needs speed, lots of it! And the CGAL backend just can't be enough for this, or for solid modeling in general.

I heard of CadQuery, a pretty neat piece of software, if it weren't for its fragile installation procedure, which requires an immense number of compile-time dependencies.

I tried to persuade the code into compiling, which kinda worked... Through a lengthy script that patched many files to push the installation forward, I got much progress, but ultimately quit.


And here's what I did: reimplement OpenSCAD with an OCCT backend. Nah, just kidding. Well, kinda. I've written a full lexer and parser, a half-baked compiler and a minimal bytecode interpreter, all in plain old C, linked everything against OCCT and... got a Standard_DomainError a few minutes ago. That's what's kept me busy these days.

Oh, yes, I do intend to replicate the entire thing. I'll just need to work on it for more than a week, no matter how productive it's been ;)

Edit: error fixed. Now we're making some serious cylinders!

Successful attempts warrant celebration, while failure asks for a swift change in perspective. This is illustrated by this log of mine, where I describe in detail how the last design for a 3D printable PCB wasn't working well enough, and what I'm doing instead.

After managing to produce the third prototype for the electrochemical soldering machine, I noticed the method had too many drawbacks; now I'm working on something much simpler: using a low-melting alloy and air.

I've also made a 180º turn (maybe not that much...) regarding my custom scripts for the same job. Rather than a full-stack solution involving a GUI and full G-code exporting capabilities (all of this already implemented), I'm now writing a script that simply pipes together KiCAD, OpenSCAD and Cura to get better capabilities. More details on this later! For now, I'm deciding whether to publish the previous tools, as they are incomplete but already useful in their current form...


I've also designed a mechanical device to control 16 axes with just two stepper motors. The design uses a corkscrew-shaped ramp and a shaft that just moves into and fits any of the axes. I've made a few tries with printing the pieces, but still not a working thing.

And, outside this project, I've already finished rewriting the Avogadro 2 graph code. I'm already planning changes further into the future, particularly with regards to connected group detection...

Finally, all three bugfix commits have been taken up by Debian, Ubuntu and Fedora maintainers. After the important matters have been taken care of, I'm focusing on extending Avogadro, already as part as this year's GSoC work (the application to which I'm discussing with its developer).

  • A huge optimization to bond perception, which makes importing PDB files an order of magnitude faster.
  • A fix for metals in PDB files not being loaded properly.
  • Support for formal charges in CML (and thus also SMILES, etc.), CJSON, SDF and, in a rudimentary form (detects cations in e.g. some drugs), PDB.
  • An optimization in secondary structure perception, that makes PDB import much faster when combined with other optimizations.

Right now I'm rewriting a part of Avogadro's code; the reason is, molecules in Avogadro contain some atom and bond information, as well as a graph data structure. I added some extra metadata to speed up many operations, but Geoff suggested that I move that into the graph (which makes sense). Problem is, the molecule code wasn't relying on that graph in the slightest, and trying to do so revealed it's basically nonfunctional... So a small optimization turned refactoring has now become a full-fledged rewrite :)


I've also finished my third 3D-printable PCB manufacturing device prototype. Hopefully I'll be able to try it within the coming days and report the results on Hackaday.io.

Most notably, I've fixed two more bugs in avogadrolibs, and I've contacted the Debain and Ubuntu maintainer teams to get all three fixes merged in time. Overall, working with the Avogadro 2 codebase feels pretty straightforward; it's basically a full rewrite of the original Avogadro, under the Open Chemistry umbrella.


I'm knees deep into designing the code for my project! I want to make a very extensible base to build on top of, so that involves some careful planning, especially around the data storage paradigm. Storing “data” might not be sufficient, because “data” can only be interpreted in a particular context; “knowledge” could be a more useful philosophy to work with, involving the storage of both data and enough context to understand it by itself.

I've also ordered some tungsten nozzles and ball bearings, and designed some specific stuff, but otherwise not much. I have an exam tomorrow, so I've dedicated the week to studying. I hope it plays out well...

I wish I could have done more this week, but unfortunately there are many times when one can only powerlessly watch and grieve; a feeling I, and any other person in the medical field, are familiar with. And one that might be more widespread these last few days, as violence and despair unfolds right before our eyes, once again, affecting millions of unwilling people for interests way beyond them... Maybe I'm missing the politics involved here, but honestly, doctors should worry about people first, and maybe that's the right mindset in general.

Last week I focused on studying, which is likely not of interest to anybody... But this week's activity is! I've been hard at learning the Rust programming language. What for? Well, because I intend to write all code for the Big Project in it :)

Rust is truly wonderful. It has most features one can desire, is rooted in formal theories and, more importantly, offers the highest reliability for a language almost as fast as C. I only miss a stable ABI for plugins and low-level stuff, but I'll work around that in due time.


Remember that sub-project of mine to 3D-print circuits? Well, I've uploaded it to my hackaday.io account. For now it's just a description of the mechanics and the start of a log of my work. You can read more about it there!

If you don't want to, here's a TL;DR: I want to use my custom scripts to print tiny water-tight channels and then make use of electroplating to grow copper crystals along them, controlling the process so it's reproducible and the copper actually bonds with all contacts (and the voltage doesn't fry anything!). Once I get a prototype that works, I'll upload all the files to Hackaday; I'm making a third prototype right now, after getting modest results with the previous two.

And, regarding my Big Project again... I'm in the initial design phase for its code. Which means I'm redacting a huge LaTeX document with things like design goals and code organization, and I've yet to write a single line of it ;). I don't typically dedicate that much time to design, but this one's really important (and also really complex), and I believe I'll otherwise regret it down the road.