How do I set representations properly in .vmdrc for VMD - vmd

I'm trying to setup default representations on load, and currently have added the following to the default .vmdrc file.
display depthcue off
color Display Background white
display projection orthographic
mol default color {index}
mol default style {CPK 1.0 12 0.3 12}
mol default selection {all}
menu main move 62 1236
menu graphics move 166 1477
I have also tried this line:
mol default style CPK
And variations on the selection command, such as {name A}, since I'm using hoomd and A type particles, but all to no avail, it ignores the representation style and color settings no matter what I do, but the other settings work just fine. Anyone able to help me figure out why? Thanks.

This is due to the molecule not being read into vmd upon startup (at the time of your .vmdrc file being read). I suspect you start vmd from command line with "vmd molecule.file" rather than opening up vmd first, then loading in the molecule from the File > New Molecule tab. If you do it the former way, then your "mol" instructions in the .vmdrc file are being applied to a non-existent molecule. The latter should work with the commands you've provided.
See here for how to get these defaults working for you with a command line startup.

Related

Atom - Force Tab Width 2

I just switched from Sublime Text to Atom in order to turn completely open source.
I have trouble with something very very simple: I want Atom to use always (!) and under any circumstances tab width 2 and replace tab with spaces. This setting is so simple in gedit or Sublime Text, but no matter what I am trying: When I start a new file, tab size is 2 (good!). When I use an existing file, tab size is sometimes 4. I find that a bit annoying.
My current setting in Editor are seen in the screenshot:
There is more than one tab setting
Each package (such as python-language) has its own tab setting(s). Whether the language uses the global default or its own default is up to whoever created the package, but you can generally override it.
In your screenshot, you have set the "Tab Type" to "soft". That will take care of using spaces rather than tabs. You have left the default tab width of 2. That is your global setting.
Now, if you look under "Packages" and search for "python" you will find a package named "language-python". Click on its settings button and you will find a number of syntax-specific settings.
Python Grammar
Python Console Grammar
Python Traceback Grammar
Regular Expressions (Python) Grammar
Each of those grammars has its own Tab Length setting. You can set them explicitly to 2 here to override the package's default. (You probably mostly care about the first one, Python Grammar.)
Python is different
In the case of Python, the package is explicitly configured to default to 4 spaces, probably because Python is very opinionated about whitespace, and PEP 8 recommends 4-space indents. You can see the default package setting here in the package's source:
https://github.com/atom/language-python/blob/master/settings/language-python.cson
'autoIndentOnPaste': false
'softTabs': true
'tabLength': 4
This overrides the global default. That's why Python Grammar does not honor the global tab width, the way that most packages do.
Sometimes there are package overrides
Additionally, certain packages will override your settings for syntax reasons. For example, language-make will override and use real tabs instead of spaces, because that is required by make.
In the case of Python, there is an override to use spaces. The language-python settings page offers a spot for you to change the indentation level, but it does not offer a way to switch to using tab characters. (That's probably justifiable, as tab characters and mixed indentation in Python are a very common cause of difficult-to-debug syntax errors.)
You might need to reload
Lastly, sometimes settings don't take effect completely until you reload the Atom window. You can use the Window: Reload command to do so. Or using the keyboard:
Mac: CtrlOptCmdL
Windows/Linux: CtrlAltR
This is what worked for me.
Disable all non-default packages
Open ~/.atom/config.cson, and append this (same level than the "*" element)
:
".python.source":
editor:
autoIndent: true
tabLength: 2
Re-enable all packages.
I got this help from someone else. Not my own discovery. However, for confidentiality, I cannot cite the source.
Based on soham's answer, I found that setting all tabLength: fields in ~/.atom/config.cson (assuming osx) to your desired length solved the problem.

Changing directory color with zsh + Prezto

I am using Prezto + zsh as my shell. I would like to change the color of
directories when I ls my directory. For instance, here is what I currently
have:
Obviously, this is no fun, as I’m hardly able to read my directories because the
blue is so dark. I’d like to change it to white or orange or something lighter.
This dark blue is specific only to directories. Files show up in a nice white
text. Where and what settings must I find to change this?
Update
I've seen this answer still getting attention, so here's an update. Instead of messing with individual colours as below, simply adjust the Minimum Contrast within Preferences ... -> Profiles -> Colors. I set mine to 60.
Original answer
The easier way to do this is to change the colour scheme of your terminal. For example if you are using iTerm2 on a Mac then:
Launch iTerm2
type CMD+i
In the "Colors" tab, change the setting for "Blue" (and potentially the "Bright" equivalient)
In the "General" tab, click "Copy Current Settings to Selected Profile"
If you want to revert back to the defaults you can always select a value from the "Color presets..." dropdown in the "Colors" tab.
Do the equivalent in your favourite terminal if you don't use iTerm2 on a Mac.
The answer depends on your ls. BSD ls uses the environment variable LSCOLORS; coreutils ls uses LS_COLORS instead. See your man page.
The utility module of Prezto uses dircolors (if available) to customize the colors of coreutils ls, which also comes with coreutils. So if you have coreutils, then you can use dircolors to provide actually human-readable color definitions. Read the man page of dircolors for details. Prezto reads from $HOME/.dir_colors by default, otherwise it just use the default colors defined by dircolors. You can of course specify other locations by editing on top of Prezto.
For BSD ls, there's probably no utility comparable to dircolors, so one has to manually define LSCOLORS. See the ENVIRONMENT section of the man page on its format, which should be pretty clear. An example is LSCOLORS='exfxcxdxbxGxDxabagacad', used by Prezto by default. To have it take effect, put it in runcoms, after loading Prezto's utility module.
I may be late to the party but I found the answer here: https://github.com/sorin-ionescu/prezto/issues/1539
Run in the Terminal or add to your .zshrc file
export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd"

256 colors in zsh-syntax-highlighting?

OK, so I'm using this little fancy cutting edge technology called zsh-syntax-highlighting and although I'm overall happy with the result I don't know how to set styles to anything but 8 basic colors (black, red, green, yellow, blue, magenta, cyan, white), e.g.
#works
ZSH_HIGHLIGHT_STYLES[path]='fg=red'
ZSH_HIGHLIGHT_STYLES[path]='fg=1'
#doesn't work
ZSH_HIGHLIGHT_STYLES[path]='fg=31m'
ZSH_HIGHLIGHT_STYLES[path]='fg=\e[31m'
ZSH_HIGHLIGHT_STYLES[path]='fg=%{\e[31m%}'
ZSH_HIGHLIGHT_STYLES[path]='31m'
ZSH_HIGHLIGHT_STYLES[path]='\e[31m'
ZSH_HIGHLIGHT_STYLES[path]='%{\e[31m%}'
ZSH_HIGHLIGHT_STYLES[path]='%{\e[1;38;5;118m%}'
So, how do I set more fancy colors for this zshzle plugin?
As you pointed out in the comment to chepner answer terminator is a fork of gnome-terminal and it still uses a lot of functions from gnome. In fact it seems that the whole terminator VTE widget comes from gnome and gnome-terminal by defaults "supports" only 8 basic colors. You can check that with echotc Co command. It will return 8 for both of them and for xterm too (although in xterm case this is true and only 8 colors), so basically all 3 terminal emulators you tried so far.
Now, you noted that teminator (and gnome-terminal) can in fact display more colors, but this is only because it more or less processes all those special color codes without paying attention to TERM settings what does not obey standards but well, this is gnome. Anyway to make long story short you need to set TERM environment variable to something like xterm-256color and check again with echotc Co - you should now see 256, and your ZSH_HIGHLIGHT_STYLES[path]='fg=217' should work as well.
To always start with 256 colors you can put into you .zshrc
[[ "$TERM" == "xterm" ]] && export TERM=xterm-256color
and if you have any gnome shortcuts with terminator then change them as follows
terminator -e "TERM=xterm-256color pine"
http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting suggests that the value for fg be a single integer from 0 to 255:
ZSH_HIGHLIGHT_STYLES[path]='fg=167' # Whatever color 167 is in the 256-color palette.
I Notice you are using [path], it could be that a custom path with it's own color setting is interfering with your highlight setting. Try testing with a different item such as [command]:
ZSH_HIGHLIGHT_STYLES[command]='fg=222'
I tried the above line and it works for me. I tried using the same value for path already knowing my custom prompt has its own colors and my prompts custom colors won out over the highlight.
I use a ZSH helper called Oh-My-ZSH so the following may be a bit different or not apply to you:
Make sure you are changing the color definition after the highlight plugin is loaded. On my setup it will actually generate an error but since I only tested on my syetem (OSX10,9, ZSH 5.0.7, Oh-My-ZSH, iTerm v2) your experience may be different.
Doesn't work:
ZSH_HIGHLIGHT_STYLES[command]='fg=222'
...
plugins=(git osx jim colorize zsh-syntax-highlighting)
Does work:
plugins=(git osx jim colorize zsh-syntax-highlighting)
...
ZSH_HIGHLIGHT_STYLES[command]='fg=222'

Unicode characters in qt app dont show up

I'm trying to display different language strings in my qt app by inserting each language into a QMap<QString, QString> so it can be re-used in several places and put into different combo Boxes across the application. I do this by
creating the QMap like so in the CTOR:
m_langMap.insert(QString::fromWCharArray(L"English"), "english");
m_langMap.insert(QString::fromWCharArray(L"Dansk"), "dansk");
m_langMap.insert(QString::fromWCharArray(L"Nederlands"), "dutch");
m_langMap.insert(QString::fromWCharArray(L"Čeština"), "czeck");
m_langMap.insert(QString::fromWCharArray(L"Slovenský"), "slovak");
m_langMap.insert(QString::fromWCharArray(L"Magyar"), "hungarian");
m_langMap.insert(QString::fromWCharArray(L"Român"), "romanian");
m_langMap.insert(QString::fromWCharArray(L"Latviešu"), "latvian");
m_langMap.insert(QString::fromWCharArray(L"Lietuvių"), "lithuanian");
m_langMap.insert(QString::fromWCharArray(L"Polski"), "polish");
m_langMap.insert(QString::fromWCharArray(L"Português"), "portuguese");
m_langMap.insert(QString::fromWCharArray(L"Español"), "spanish");
m_langMap.insert(QString::fromWCharArray(L"Français"), "french");
m_langMap.insert(QString::fromWCharArray(L"Italiano"), "italian");
m_langMap.insert(QString::fromWCharArray(L"Svenska"), "swedish");
m_langMap.insert(QString::fromWCharArray(L"Русский"), "russian");
m_langMap.insert(QString::fromWCharArray(L"Українська"), "ukranian");
m_langMap.insert(QString::fromWCharArray(L"Русский"), "russian");
m_langMap.insert(QString::fromWCharArray(L"中文"), "chinese");
m_langMap.insert(QString::fromWCharArray(L"日本語"), "japanese");
I then insert them into the combo box:
QMap<QString, QString>::const_iterator it = m_langMap.begin();
while (it != m_langMap.end())
{
ui->comboBox->addItem(it.key());
++it;
}
When the app runs, I see the following:
However, if I create a separate .ui file and insert the map the same way, I see the following (even if I include this separate Dialog class into the same application), so clearly there is no font issue as far as the App not knowing how to render the different character sets....yet I cant figure out why the first one won't render the character sets?
Can someone tell me why the first doesn't work but the second does? I checked the Designer and its Locale is set to 'C, Default' in both ui files I've shown below. I can't seem to figure out what else is causing the difference for the first not to work, and the second does work within the same application.
Thanks for any help!
The other test Dialog:
Your code is correct, but the problem is that your source file cannot contain Unicode characters - apparently it is using different coding.
Save file as UTF-8 and everything should work!
In the first screenshot the font used by the combobox is much larger than in the second screenshot. My guess is that you have changed the font either in the GUI designer or in the code and the second (working) screenshot is using the default font. It might be that when you have changed the font size, you have also changed the font to something that doesn't contain all the required Unicode characters. Try changing the font used by the combobox to something else.

How to get coordinates of an svg?

How can I find out the coordinates of an svg? I have an Adobe Illustrator file that contains a map, this has been drawn and separated into US states, how can I find the coordinates of each state?
I'm just using the US map as an example, I'm going to potentially use this technique for several other maps (much more local!!).
Inkscape does that beautifully. It has a command interface, described in http://tavmjong.free.fr/INKSCAPE/MANUAL/html/CommandLine.html . (The link is to a copy of the manual on the website of its author, Tavmjong Bah. Note that it warns that the manual hasn't been updated for the latest version of Inkscape. However, the command worked fine when I tried it.)
This command
inkscape -S some_file.svg
will output lines containing an element id, the x and y coordinates of the top-left corner, and the element's width and height. There is one line for each element of the SVG. Here's an example:
svg2293,26.447175,24,97.105652,92.450851
layer1,26.447175,24,97.105652,92.450851
MyStar,26.447175,24,97.105652,92.450851
This example comes from http://tavmjong.free.fr/INKSCAPE/MANUAL/html/CommandLine-Query.html . It extracts information from an SVG which includes a star shape, shown on my first link.
On my Windows 10 system, Inkscape lives in c:\Program Files\Inkscape\ , and the executables are in the bin\ subdirectory of that. If I cd to that subdirectory, Windows will recognise the inkscape command; likewise if I use the full path to the executable from somewhere else, e.g.
"c:\Program Files\Inkscape"\bin\inkscape -S some_file.svg
Putting it on my PATH would presumably also work.
Inkscape has a lot of other commands, which include others for extracting information about object positions and sizes. The latter are called "query commands". One can extract information about a specified object, e.g.
inkscape --query-id=zoom-in -X /usr/share/inkscape/icons/icons.svg
This is an example of finding the x position of the zoom-in icon in the default icon file on a Linux system.
To save the output to a file, use > . E.g.
"c:\Program Files\Inkscape"\bin\inkscape -S some_file.svg > coords.txt
As it's reassuring to see actual examples, here are two screenshots of this working.
Once you have the data in a file, you can read it into programs. Below is a screenshot of me doing this in the R programming language, using the read_csv function ( https://readr.tidyverse.org/reference/read_delim.html ). This puts the data into a table, which I then displayed.
SVG have an XML structure. The states will be in <path> tags, hopefully with the name of the state somewhere as an attribute. The coordinates of a path are defined by the d attribute, but they can get quite complex as they can be relative or absolute and have various types of curves. With curves, it's probably simplest to consider just the final two values, which is where the curve ends.
For full details, see: http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation
The situation may be more complex if further transforms are applied to the paths. Good luck!

Resources