05 December 2013

534. Adding new options to ECCE -- adding solvation models for G03 (G09)

To minimize the amount of manual editing of my input files I've started to modify the menus in ECCE. One thing that was missing before was the option of selecting a solvation model for Gaussian jobs. I've added that now.

I will eventually submit my changes upstreams, but for now I'll just post a clunky list of changes that I've made:
There are two files to edit:

apps/scripts/codereg/ged03theory.py.

Add the following right after the DFT options section and before the MP options section (ca line number 273 in my case)
#Theory options solvation -CAO sovSizer = EcceBoxSizer(self, label = "Solvation", cols = 2) sovLeftSizer = EcceVBoxSizer() sovRightSizer = EcceVBoxSizer() #Use solvation self.useSCRF = EcceCheckBox(self, #useCosmo label = " Use SCRF" name = "ES.Theory.SCF.UseSCRF", default = False) sovLeftSizer.AddWidget(self.useSCRF, border = EcceGlobals.BorderDefault) #SCRF type scrfChoice = ["PCM", "CPCM", "IPCM", "SCIPCM", "SMD", "Dipole"] self.scrf = EcceComboBox(self, choices = scrfChoice, name = "ES.Theory.SCF.SCRF", label = "SCRF type:", default = 0) sovRightSizer.AddWidget(self.scrf, border = EcceGlobals.BorderDefault) #Solvent type solventChoice = ["Water", "Acetonitrile", "Methanol", "Ethanol", "Manual", "Benzene", "Chloroform", "Diethylether", "Dichloromethane", "Dichloroethane", "Carbontetrachloride", "Toluene", "Chlorobenzene", "Nitromethane", "Heptane", "Aniline", "Acetone", "Tetrahydrofuran", "Dimethylsulfoxide", "Argon", "Krypton", "Xenon", "n-Octanol", "1-Butanol" "Cyclohexane", "Isoquinoline", "Quinoline", ] self.solvent = EcceComboBox(self, choices = solventChoice, name = "ES.Theory.SCF.Solvent", label = "Solvent:", default = 0) sovRightSizer.AddWidget(self.solvent, border = EcceGlobals.BorderDefault) self.scrfDielec = EcceFloatInput(self, default = 78.4, name = "ES.Theory.SCF.Dielectric", label = "Dielectric Constant:", hardRange = "(0..)", unit = "Debye") sovRightSizer.AddWidget(self.scrfDielec, border = EcceGlobals.BorderDefault) sovSizer.AddWidget(sovLeftSizer, flag = wx.ALL) sovSizer.AddWidget(sovRightSizer, flag = wx.ALL) self.panelSizer.Add(sovSizer) #End theory options solvation -CAO

Also add the following to the def CheckDependency(self) block, right before the "if (EcceGlobals.Category == "MP" or" line:
# SCRF solvation -- CAO if EcceGlobals.Category == "DFT" or EcceGlobals.Category == "SCF": self.solvent.Enable(self.useSCRF.GetValue()) self.scrf.Enable(self.useSCRF.GetValue()) self.scrfDielec.Enable(self.useSCRF.GetValue() and self.solvent.GetValue() == "Manual") # end SCRF

Edit apps/scripts/parsers/ai.gauss03 and put the following somewhere in the file.
############################################################################## # # Description: # SCRF options field -CAO # ############################################################################## sub SCRFOptions { my($options,$result); $result = ""; $options = ""; #scrf type if ($AbiDict{"ES.Theory.SCF.UseSCRF"}) { if ($AbiDict{"ES.Theory.SCF.SCRF"} eq "" ) { $options .= "PCM,"; } else {$options .= ($AbiDict{"ES.Theory.SCF.SCRF"}).","}; # solvent/dielectric if ($AbiDict{"ES.Theory.SCF.Solvent"} eq "Manual") { if (defined($AbiDict{"ES.Theory.SCF.Dielectric"})) { $options .= "Dielectric=".$AbiDict{"ES.Theory.SCF.Dielectric"}.""; } } elsif ($AbiDict{"ES.Theory.SCF.Solvent"} eq "") { $options .= "Solvent=water"; } else { $options .= "Solvent=".$AbiDict{"ES.Theory.SCF.Solvent"}; } if ($options ne "") { $result = "SCRF=("; $result .= $options; $result .= ") "; } return $result; } }
Also add the following right below the "$route .= &SCFOptions;" line:
$route .= &SCRFOptions;

And you're done:

03 December 2013

533. Adding a new Exchange/Correlation functional to ECCE. M06 for G03 (G09)

Nothing fancy here. I'd just like to be able to select the M06 functional, which is available in G09, using the ECCE interface.

At some point in the future I might set up separate files for G09, but for now I run G09 using the G03 files in ECCE.

See here and here for how to add basis sets to ECCE.

You'll need to edit 2-3 files. I did this in ECCE v7.0.

Edit apps/scripts/codereg/ged03theory.py
185 xcFuncChoice = ["None", 186 "M06 (hybrid)", 187 "SVWN 5 (local)", 188 "SVWN 1/RPA (local)", 189 "BLYP (nonlocal)",
Edit apps/scripts/parsers/ai.gauss03
635 if ($xcFun eq "SVWN 1/RPA (local)") {# convert our terminology to Gaussian's 636 $result = "SVWN"; 637 } elsif ($xcFun eq "SVWN 5 (local)") { 638 $result = "SVWN5"; 639 } elsif ($xcFun eq "M06 (hybrid)") { 640 $result = "M06"; 641 } elsif ($xcFun eq "BLYP (nonlocal)") {

Editing apps/scripts/parsers/Gaussian-03.expt isn't necessary to get this to work, but I did it anyway. Not sure if it 'does' anything:
557 if ($method =~ /b.*3lyp/ || 558 $method =~ /m06/ || 559 $method =~ /bhandh/ || 560 $method =~ /vscx/ || 561 $method =~ /hcth407/ || 562 $method =~ /hcth147/ ||

You should now be able to select M06 in the Theory Details dialogue:


02 December 2013

532. TEMPer temperature monitoring USB stick on Debian Wheezy

Because the air conditioning in my office has a habit of turning itself off, and since I'm running my beowulf cluster in there, and since it's Australia, I've become interested in monitoring the temperature in my office.

The USB stick itself looks nothing special, so here's the card from the box it came in.


A colleague of mine got a TEMPer thermometer USB (0c45:7401 Microdia) back when he didn't have any air conditioning at all in his office and wanted to prove to the university that the temperature got so high that it was impossible for him to do any work on some days. He's now got air conditioning.

Anyway, plugging in the USB stick got me the following:
* /dev/hidraw5 and /dev/hidraw6 get created

* DMESG shows
[441126.932728] usb 2-4.2: new low-speed USB device number 11 using ehci-pci [441127.025790] usb 2-4.2: New USB device found, idVendor=0c45, idProduct=7401 [441127.025803] usb 2-4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [441127.025811] usb 2-4.2: Product: TEMPerV1.2 [441127.025818] usb 2-4.2: Manufacturer: RDing [441127.030229] input: RDing TEMPerV1.2 as /devices/pci0000:00/0000:00:02.1/usb2/2-4/2-4.2/2-4.2:1.0/input/input24 [441127.030516] hid-generic 0003:0C45:7401.000F: input,hidraw5: USB HID v1.10 Keyboard [RDing TEMPerV1.2] on usb-0000:00:02.1-4.2/input0 [441127.033234] hid-generic 0003:0C45:7401.0010: hiddev0,hidraw6: USB HID v1.10 Device [RDing TEMPerV1.2] on usb-0000:00:02.1-4.2/input1
* lsusb shows
Bus 002 Device 011: ID 0c45:7401 Microdia

Searching online for 0c45:7401 brought up this cheesily title post: http://www.linuxjournal.com/content/temper-pi

From that post:
 If instead dmesg says this:
[snip]
and lsusb says:
$ lsusb
Bus 001 Device 005: ID 0c45:7401 Microdia
then congratulations, you have the new TEMPer probe and will have to use completely different software. 
While that sounds as if you'll have continue searching for a new how-to, in fact the entire post is about that particular version. So, I followed the instructions at Linux Journal -- I'll just offer my step by step version of it here with some added detail:

sudo apt-get install python-usb python-setuptools snmpd git
sudo easy_install snmp-passpersist
mkdir ~/tmp
cd ~/tmp
git clone git://github.com/padelt/temper-python.git
cd temper-python/
sudo python setup.py install

At this point I could get a temperature reading by doing:
$ sudo temper-poll 
Found 1 devices Device #0: 24.4°C 75.9°F
But running stuff as root is unsatisfying, so I created a UDEV rule:
$ sudo vim /etc/udev/rules.d/80-temper.rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7401", GROUP="users", MODE="0666"
I then unplugged the USB stick, did
sudo service udev restart

and plugged it back in.
$ temper-poll 
Found 1 devices
Device #0: 25.8°C 78.3°F

Sweet.
Finally, I set up a cronjob that would check the temperature, update a plot and put it in my Dropbox:
$ crontab -e
*/2 * * * * sh /home/me/temper.sh
where temper.sh looks like this:
temp=`/usr/local/bin/temper-poll |grep Device|gawk '{print $3}'|sed 's/°C//'` when=`date +%s` thetime=`date +%D' '%T` if [ -n "$temp" ]; then echo $when $temp $thetime>> /home/me/temper.dat fi gnuplot /home/andy/temper.gplt cp /home/me/temper.eps /home/me/Dropbox
The temper.gplt script looks like this:
set term postscript eps enhanced colour set output 'temper.eps' unset key set ylabel 'Temperature (Celsius)' set border 3 set xtics nomirror set ytics nomirror unset xlabel set xdata time set multiplot set size 0.5,0.45 set origin 0,0.05 set timefmt "%H:%M:%S" set title 'Daily' set xtics 30000 plot 'temper.dat' u 4:2 w points pt 1 ps 0.15 set origin 0.5,0.05 set title 'By Day' set timefmt "%m/%d/%y" set xtics 100000#0 plot 'temper.dat' u 3:2 w points pt 2 ps 0.5 set size 1.0,0.5 set origin 0.0,0.5 set timefmt "%m/%d/%y %H:%M:%S" set xtics 30000 set title 'Log' plot 'temper.dat' u 3:2 w lines
and the plot looks like this:
Temperature in a lab at a leading Australian research institute. In five years they have not been able to fix the air conditioning.  On 01/04 someone pushed a cardboard box against the sensor which lead to a slower change in temperature.