Category: Readable Reads


Gromacs Genion Fix

Gromacs is a wonderful open source molecular dynamics simulation package that I will be using for some of my research here at Imperial. However, as is oftentimes the case with scientific packages (both open and closed source), there are some minor quirks that I’ve had to learn to deal with. One of those quirks was elusive and irritating enough that I’ve decided to write a short howto so that someone elsewhere might not have to spend as long as I did trying to solve it.

Warning: I am not a computer scientist or programmer, and barely even a scientist. There is no guarantee that this code will not destroy your data, so be sure to backup all files before attempting this fix (which you should be doing anyways)! Having said that, it worked for me, and I can only hope for the best.

Version: This behaviour is seen on Gromacs 4.0.7. The proposed fix uses standard unix command line utilities (and is a very ugly but working hack).

Symptoms: While trying to neutralize the charge on a solvated system using genion to add X ions, genion insists on instead adding kX ions, where k is an integer. Additionally, attempts to use genion’s own “-neutral” option also fail, with it calculating the correct number of ions to add, but then adding it multiple times.

Cause: The reason this happens is due to the way the topology files are constructed. Near the end of the topology file is a section that details the type and number of molecules in the system. For instance, it might look something like this:

[ molecules ]
; Compound #mols
Protein_A 1
Protein_B 1
SOL 27550

When genion runs, if one selects option 12, “solvent”, genion will replace some of the solvent “SOL” molecules with the specified ions, perhaps resulting in the following, where we specified the addition of 8 NA+ ions:

[ molecules ]
; Compound #mols
Protein_A 1
Protein_B 1
SOL 27542
NA+ 8
CL- 0

However, sometimes, due to prior processing with other tools, there will be multiple “SOL” lines, like so:

[ molecules ]
; Compound #mols
Protein_A 1
Protein_B 1
SOL 72
SOL 75
SOL 27403

Notice that the total number of solvent molecules is the same in both examples. However, genion gets confused when multiple solvent lines are present, and seemingly acts on each line! This causes the resulting topology file to look like this:

[ molecules ]
; Compound #mols
Protein_A 1
Protein_B 1
SOL 64
NA+ 8
CL- 0
SOL 67
NA+ 8
CL- 0
SOL 27395
NA+ 8
CL- 0

Notwithstanding the fact that the resulting topology file is decidedly not neutral, the topology file also then for some reason does not match up with the .gro file, which causes additional problems down the line.

Of course, by now, you’ve probably figured out how to solve the problem yourself: just make sure to consolidate multiple SOL lines before running genion, and you’re golden! Since I am lazy and do not like doing that by hand (and because I’ll probably need to bulk process many proteins sometime in the future), I hacked together a really ugly but working bash script to do just that. Following:

#!/bin/bash
# Consolidate the solvent molecules in the topology file.
filename=example.top
sol_mol=0
cp $filename $filename-new
while read line; do
sed "/$line/d" $filename-new > $filename-new2
mv $filename-new2 $filename-new
add=$(echo $line | sed 's/SOL//')
sol_mol=$(($sol_mol+$add))
done < <( tail -n $(( $(cat $filename | wc -l) - $(grep " molecules " $filename -n | sed 's/:\[ molecules \]//') + 1 )) $filename | grep SOL )
echo "SOL $sol_mol" >> $filename-new
mv $filename-new $filename

If anyone actually stumbles across this page and finds it useful (which I rather doubt, but you never know), I’d love to hear about it.

~William~

This past Winter, one of the ongoing discussions that my housemates and I would have dealt with the amount of money that we were wasting keeping on electric appliances in the house unnecessarily. Everyone knows that keeping the lights on is a waste of money, but exactly how much? At first glance, it seems a simple enough calculation: just multiply the power rating (wattage) by time by cost of electricity and you have a simple answer. However, one factor that would then be missing is the fact that the “wasted” energy of the light bulb goes then to a large extent to heating the house (this is why compact fluorescent bulbs and LEDs are so much more efficient: they don’t generate as much waste heat).

My housemates and I never got around to actually doing the calculations for us in particular, but the question again occurred to me today, so I sat down and did a quick back of the envelope calculation (with extensive use of google and wikipedia). Following:

Cost per Joule of Heat from Electricity

The average residential cost of electricity for 2009 so far is 11.38 cents / kWh (http://www.eia.doe.gov/cneaf/electricity/epm/table5_6_b.html). 1 kWh = 3.6 * 10^6 J. Hence, it costs 3.16111111 * 10^-6 cents / J to heat your house using electricity.

Cost per Joule of Heat from Natural Gas

The average residential cost for natural gas in January 2009 was 12.41 dollars / thousand cubic feet of natural gas (http://tonto.eia.doe.gov/dnav/ng/ng_pri_sum_dcu_nus_m.htm). 1000 ft^3 = 2.83168466 * 10^4 liters.
At STP, 1 mol of gas = 22.4 liters, so 1000 ft^3 = 1264.14494 moles.
Assume that natural gas is 100% methane (not quite true, but close enough).
Heat of combustion for methane: 890 kJ/mol.
Therefore, 1241 cents produces 1125089 kJ of heat
==> 906.598711 kJ / cent
= 906598.711 J / cent
= 1.10302385 * 10^-6 cents / J.

Thus, it costs almost three times as much to heat your house using electricity than natural gas. Of course, this calculation is only partially relevant for such things as light bulbs, Xboxes, computers, etc., because some of the energy is lost (radiation from the house, energy used to send information over wires or the wireless, etc.), but even in the perfectly efficient scenario (which is only likely to occur with space heaters), it’s still considerably cheaper to use natural gas.

For a variety of reasons, I’ve recently been thinking and reading a lot about one of the most recognized hallmarks of academia: the letter of recommendation. What purpose exactly do those sheets of paper (or these days, electronic files) really serve? And what are the implications and ethics surrounding the writing of those letters? For the sake of consistency, let me first go ahead and categorize the personal statement as a very specific subspecies of the letter of recommendation. It just happens to be one written by the subject him/herself (for the sake of readability, I have used the masculine pronoun in the rest of the essay).

To begin, letters of recommendation are a critical component to advancement at many stages of an academic career: for more selective undergraduate institutions and programs, for admission to graduate and professional schools, for fellowship applications, and then even after graduation, for any post-doctoral or faculty positions in academia. However, what do they really say about the candidate? Though stories abound about the letters of recommendation that sank professional school hopefuls, by and large, they tend to be positive, and in the case of applications to fellowships like the Marshall or Rhodes, I’ve read that “superlatives are the coin of the realm”.

So if for the most part, letters of recommendation for candidates do not stand out by means of praise, what do they do? My answer: they paint a portrait of the applicant. And like portraits, different artists—including the applicant himself—may choose to paint from a different angle, capturing only one side of a hopefully three-dimensional subject. Furthermore, a good artist will capture the best of the subject, but not try to re-imagine him as something more than he is. Indeed, many selection committees guard against that very temptation by not only arranging a face-to-face interview, but also asking for quite a few letters from different people—It is not uncommon for Rhodes applicants to have seven letters of recommendation in addition to their personal statements. By doing so, one is effectively asking for a series of portraits, all of which are made from different angles, capturing some unique aspect of the candidate. The best letters have to thus be entirely true, so that the selection committee is able to reconstruct a single three dimensional model from the combination of letters, interview, transcript, and curriculum vitae. While overly zealous praise might seem to be in the best interests of the candidate, if that praise seems at odds with the pictures painted by the other factors, it will hinder, rather than support. This is even more important for the personal statement; we are taught in America to focus on our achievements, but we should never do so at the cost of veracity.

So what are the implications for undergraduate students seeking admission to professional or graduate schools? Well, I think the most important things to take from this are that (1) it is important to find letter writers who know you well in a variety of different settings and (2) do not over-exaggerate your own accomplishments. Letters of recommendation cannot make you seem to be a better person than you are or gloss over the shortcomings you possess, but like a good portrait, they can accentuate the best in you to the selections committee. Just make sure that the letter writers know enough about you to be able to write about those particular wonderful characteristics that make you worthy of your dreams.

In closing, I would just like to exhort everyone to thank their recommenders. Writing a good letter is in my admittedly limited opinion, at least as difficult as writing a good personal statement. And just think how many times you redrafted that silly thing!

In deep gratitude of the multitudinous faculty and staff who’ve made my academic dreams possible…

William

Skip the background and go straight to the ethical question I’m pondering

The day I turned 13, I started keeping a diary as an encrypted Microsoft Word document. Unfortunately, this was also during that time of my life where I was, ah, experimenting with my computer, and I managed to corrupt the boot-loader of my hard disk sometime in the next week. I didn’t have quite the knowledge to recover my files then (I was young and this was one of the first times I’d seriously crashed my computer), so my first week’s worth of journaling was lost into the ether. I switched journaling applications quite a few times in the next couple of years (incl. Microsoft Word, iDailyDiary, Memoranda, Korganizer just to name the major ones), but suffice it to say that I made very certain from then on to keep working copies of all my writings. I more or less stopped journaling shortly before matriculating at Indiana University, with the hiatus punctuated only intermittently by entries on the predecessor of this blog, and then ended during my 5-month study abroad in Germany.

In any event, for the first time in many years, I pulled out my old diary entries, mostly to update the format to something more persistent (let me say that there is no good way to export Korganizer journal entries; I ended up doing a fair amount of text processing using regex and spreadsheets), but I couldn’t help but read a bit as well. If you haven’t yet intuited, this blog post covers my reflections on the entire endeavor—credit for the blog title goes to Kate S., who once managed to keep a Meta-journal without being meta at all.

Anyways, the first thing that I, as a good editor, noted, was how horrible my style was:

Dear Diary
[...] After I got back, I was just in time for 7th period Pre-Calc where we reviewed synthetic division. That was fun. After school, I slept and slept and slept. Then I got up, ate dinner, and now I am about to play SimCity 3000. Have a nice day. [...] —Thursday, November 12, 2002

Of course, it doesn’t at all compare to, say, rereading my elementary school mystery short the Search for the Missing Atom (a story for another day), but still, I cannot help but marvel sometimes at how silly I once was.

However, upon actually reading the content, what more impressed me was the seriousness I impregnated into issues that today I would just laugh at. When Mother threatened to remove band from my life, due to the inordinate amounts of time I was spending on it and my lack of time management skills, I was utterly and completely devastated (she didn’t actually; the threat itself was sufficient). After encountering Dante for the first time, I took to heart his Arthurian-esque idealization of Beatrice. For several years, my diaries also contained obscure references to me failing at a particular task I assigned myself, which I never once mentioned the details of (nor shall I here)—it’s striking how much weight I placed upon that edict that I could not admit it to myself even in the privacy of my twice (and sometimes thrice) encrypted diary.

If I were to relive those years, I have no doubt that I would want to make some different decisions. Not because those decisions turned out to be incorrect (though I certainly had my fair share of those), but more especially because my personality and values have changed. Though I still recognize many aspects of that 13 year old kid, the truth of the matter is that were we to meet today, I would probably be more than a little embarrassed for that child, and even more embarrassed at myself that I could not simply rejoice in his youthful wonder and curiosity about the world.

And that finally brings us to the second half of this post, to a question I’ve been wrestling with for the past several months: is it ethically correct for me to determine the life path of my future self, who’ll probably look back on me from as wide of a chasm as I now look upon that 13 year old kid? A bit more background: I applied to and was accepted by the Yale Medical Scientist Training Program, but due to a fellowship I won, I’ve been permitted to defer two years before matriculating. As such, I have another 1.5 years before I have to commit to that career path. However, once I do, it’ll at least be 8 years before I finish, and the force of inertia will probably push me onto a pretty standardized career track for quite possibly the rest of my working life. I doubt my courage to step off that path once I’m on it, and worry that my future self will not find it as appealing as I might now.

So, back to the question. On the one hand, in our society, we generally do not allow people to make binding agreements on other responsible adults without their consent. However, there seems to be an understood special relationship between one’s past and future selves, whereby a contract signed binds both the present and all future selves. Legal precedent would seem to support my right to make decisions for my future self. (On a sidenote, I do wonder whether and what courts have ruled about the status of decisions made when the “person” has changed drastically, such as due to a brain injury or something along those lines).

Furthermore, we are constantly being told that we have to sacrifice present pleasure for future happiness (though less so in this instant gratification society of ours). This suggests that current standards implicitly assume that the person of the present has the right to make decisions that are binding upon their future self, ostensibly for the future self’s benefit. But what if it’s not to the future self’s benefit? The converse to the previous statement is that one should NOT sacrifice future happiness for the present. If it is the prerogative of the present to bind the future, why then should a drug addict not be allowed to destroy their future self’s body for a moment of bliss. It is almost always the case that the negative repercussions are never felt at the moment those decisions are made, so why worry about the feelings of someone else who’s left to pick up the pieces?

Or perhaps, to generalize the preceding a little bit, what is the proper choice to make, when one is confronted with the following situation. You have the choice between two different futures, “A” and “B”. “A” is very much the future you want, so it seems like the obvious decision. However, being reasonably well informed about your own personality, you know that by the time future “A” rolls by five years down the line, you’ll wish you’d chosen future “B”. The problem, though, is that making choice “B” right now is something that clashes irreconcilably with who you are.

Luckily, my dilemma is nowhere near as drastic as that described above, especially since I still haven’t figured out yet if I actually want to do an MD/PhD! But one of the many arguments I’m wrestling with is that I shouldn’t make that sort of a decision committing myself so far into the future when my interests have changed so much even in the past several years. What are your thoughts? Do you ever worry about the ethical implications of making decisions for your future self? Or am I just weird :-)

~William~

Preparations

Gallon size zip-lock bag? Check.
Wallet? Present.
Ticket? Ready.
Identification? Check.
Thumb for prints? Hopefully.

Analog non-digital wristwatch? Borrowed from a friend.
Absolutely NO cellphones? As specified.
Hooded jacket? Stored safely on the next table.
Number 2 pencils? Four sharpened and ready.

A deep breath and silent invocation to the spirit of Spock,
And for the next 4 hours, it’s LSAT time.

On Medicine

How do a physician and an electrician differ?
Is it the nature of the craft? Physics and biology are both sciences.
Is it the training? An apprenticeship is an apprenticeship, and only time and practice make a master.
What about danger? Electrocution kills just as effectively as a needle-stick.

How indeed differs a physician from an electrician?
Both can destroy lives with an ill-placed touch.
Both construct the circuits that permit modern life.
And of course, both deliver a bill for their labors.

No, the only difference between a physician and an electrician,
And the greatest difference possible indeed, lies in the people who remember.

Pomp and Circumstance

Identical gowns, caps, and tassels,
Black robes billow across the floor.
Cameras and parents crane,
Intermittent hollers.

Songs of joy and words of wisdom,
Remark on individual achievement.
Unceremonious standing, sitting;
names omitted, schools exalted.

Departure. Time is of the essence,
an evening basketball game presents.

Stammzellen Kontroversen

So, I had to write up a “wiki” encyclopedia article for my German culture class, and my partner Anna and I decided on writing about the stem cell controversy. We had the option of doing it on a sakai based wiki on IU’s oncourse course management system, but I figured that it would be a lot easier for me just to do it as an actual webpage, and it’d look more professional that way anyways.

If you happen to enjoy reading Deutsch, then feel free to read up on Stem Cells

Auf Wiedersehen!
Johann

Photo Shoot

Tick, tick, tick, tock.
The photographer adjusts his tripod for the third time. A lady waits nearby. The Sun glares, moisture hides. Wrists twitch. Hands, large and small, slowly circle. Light breeze, welcomed. Gone again. Where is he? The photographer adjusts his tripod. The lady checks a small notepad. Wrist flicks. Halfway around, time to go. Next shoot.

Day

Ring. Ring. Ring.
Christopher Columbus playing in the background.
Just a quick SNOOZE.

Flurried rush. Class starts.
Electrochem, spectrochem, algebra STOP.

Lunch…GO!

Magnetism, transition metals, redox, and then…
Lab meeting. Meeting labs,… done.

Labyrinthine writing, minotaur minds. 5 4 3 2 ONE!!!
It don’t mean a thing, if it ain’t…
Equipment trolley. My choice.

Temporal work. End.

Powered by WordPress. Theme: Motion by 85ideas.
Copyright © 2006-2010 Free2Fall.net. All rights reserved.