Skip to content

Instantly share code, notes, and snippets.

@ntBre
Created April 4, 2022 16:11
Show Gist options
  • Select an option

  • Save ntBre/22647852c70bb1f6784c89437487b629 to your computer and use it in GitHub Desktop.

Select an option

Save ntBre/22647852c70bb1f6784c89437487b629 to your computer and use it in GitHub Desktop.
Script to visualize a selected molecular geometry with molden
#!/usr/bin/perl
use warnings;
use strict;
use feature "say";
use File::Temp qw/ tempfile /;
my ($fh, $filename) = tempfile();
my $mol = `xclip -o -selection primary`;
$mol =~ s/\s+$//;
my @sp = split /\n/, $mol;
if ($sp[0] !~ /^\s*\d+/) {
say $fh scalar @sp;
say $fh "generated from primary selection by `molecule` script";
}
say $fh $mol;
exec 'molden', $filename;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment