Molecular Modeling Software
リビジョン | e9ee338d3f718a77210ed254f71afc6dd2c0af62 (tree) |
---|---|
日時 | 2011-07-21 17:44:49 |
作者 | toshinagata1964 <toshinagata1964@a2be...> |
コミッター | toshinagata1964 |
Importing frcmod is improved. Import AMBER Lib (in MM/MD->Tools menu) is implemented. Ruby: Molecule#resize_to_fit is implemented. Molecule.open now accepts empty arguments for creating a new untitled document. Kernel.message_box was causing exception when :ok is given; fixed.
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@76 a2be9bc6-48de-4e38-9406-05402d4bc13c
@@ -13,13 +13,13 @@ | ||
13 | 13 | <div class="centered" lang="en"> |
14 | 14 | <h1>Molby</h1> |
15 | 15 | <h2>An Interactive Molecular Modeling Software<br />with Integrated Ruby Interpreter</h2> |
16 | -<h3>Version 0.5.5 build 20110702</h3> <!-- version --> | |
16 | +<h3>Version 0.5.5 build 20110721</h3> <!-- version --> | |
17 | 17 | <h3>Toshi Nagata</h3> |
18 | 18 | </div> |
19 | 19 | <div class="centered" lang="ja"> |
20 | 20 | <h1>Molby</h1> |
21 | 21 | <h2>対話型分子モデリングソフトウェア<br />(Ruby インタプリタ内蔵)</h2> |
22 | -<h3>Version 0.5.5 build 20110702</h3> <!-- version --> | |
22 | +<h3>Version 0.5.5 build 20110721</h3> <!-- version --> | |
23 | 23 | <h3>永田 央</h3> |
24 | 24 | </div> |
25 | 25 | <hr /> |
@@ -191,13 +191,13 @@ document is open, returns an empry array. | ||
191 | 191 | <div id="method-M000190" class="method-detail"> |
192 | 192 | <a name="M000190"></a> |
193 | 193 | <div class="method-heading"> |
194 | +<span class="method-name">new → (new) <a href="Molecule.html">Molecule</a><br /> | |
194 | 195 | <span class="method-name">new(file, *args) → (new) <a href="Molecule.html">Molecule</a><br /> |
195 | 196 | </span> |
196 | 197 | </div> |
197 | 198 | <div class="method-description"> |
198 | 199 | <p> |
199 | -Create a new molecule and call | |
200 | -<a href="Molecule.html#M000200">molload</a> method with the same arguments. | |
200 | +Create a new molecule. If any arguments are given, call <a href="Molecule.html#M000200">molload</a> method with the same arguments. The created molecule has no associated document window. | |
201 | 201 | </p> |
202 | 202 | <p> |
203 | 203 | <i>See Also:</i> <a href="#M000324">Molecule#open</a>, which opens the molecule as a document (i.e. with associated window). |
@@ -208,12 +208,13 @@ Create a new molecule and call | ||
208 | 208 | <div id="method-M000324" class="method-detail"> |
209 | 209 | <a name="M000324"></a> |
210 | 210 | <div class="method-heading"> |
211 | +<span class="method-name">open → (new) <a href="Molecule.html">Molecule</a><br /> | |
211 | 212 | <span class="method-name">open(file) → (new) <a href="Molecule.html">Molecule</a><br /> |
212 | 213 | </span> |
213 | 214 | </div> |
214 | 215 | <div class="method-description"> |
215 | 216 | <p> |
216 | -Open a molecule from file as a document. | |
217 | +Open a molecule from file as a document. If file is not given, an untitled document is created. | |
217 | 218 | </p> |
218 | 219 | <p> |
219 | 220 | <i>See Also:</i> <a href="#M000190">Molecule#new</a>, which creates a new Molecule object but does not open as a document (i.e. no associated window is opened). |
@@ -2135,6 +2136,19 @@ representing the array of residue names. | ||
2135 | 2136 | </div> |
2136 | 2137 | </div> |
2137 | 2138 | |
2139 | +<div id="method-M000216" class="method-detail"> | |
2140 | +<a name="resize_to_fit"></a> | |
2141 | +<div class="method-heading"> | |
2142 | +<span class="method-name">resize_to_fit → self<br /> | |
2143 | +</span> | |
2144 | +</div> | |
2145 | +<div class="method-description"> | |
2146 | +<p> | |
2147 | +Resize the model drawing to fit in the window. | |
2148 | +</p> | |
2149 | +</div> | |
2150 | +</div> | |
2151 | + | |
2138 | 2152 | <div id="method-M000282" class="method-detail"> |
2139 | 2153 | <a name="M000282"></a> |
2140 | 2154 | <div class="method-heading"> |
@@ -120,6 +120,19 @@ Ruby_NewFileStringValue(const char *fstr) | ||
120 | 120 | #endif |
121 | 121 | } |
122 | 122 | |
123 | +VALUE | |
124 | +Ruby_ObjToStringObj(VALUE val) | |
125 | +{ | |
126 | + switch (TYPE(val)) { | |
127 | + case T_STRING: | |
128 | + return val; | |
129 | + case T_SYMBOL: | |
130 | + return rb_str_new2(rb_id2name(SYM2ID(val))); | |
131 | + default: | |
132 | + return rb_str_to_str(val); | |
133 | + } | |
134 | +} | |
135 | + | |
123 | 136 | #pragma mark ====== Message input/output ====== |
124 | 137 | |
125 | 138 | /* |
@@ -140,7 +153,7 @@ s_Kernel_MessageBox(int argc, VALUE *argv, VALUE self) | ||
140 | 153 | str = StringValuePtr(sval); |
141 | 154 | title = StringValuePtr(tval); |
142 | 155 | if (bval != Qnil) { |
143 | - bval = rb_str_to_str(bval); | |
156 | + bval = Ruby_ObjToStringObj(bval); | |
144 | 157 | s = RSTRING_PTR(bval); |
145 | 158 | if (strncmp(s, "ok", 2) == 0) |
146 | 159 | buttons = 1; |
@@ -150,7 +163,7 @@ s_Kernel_MessageBox(int argc, VALUE *argv, VALUE self) | ||
150 | 163 | rb_raise(rb_eMolbyError, "the button specification should be either nil, :ok or :cancel"); |
151 | 164 | } else buttons = 3; |
152 | 165 | if (ival != Qnil) { |
153 | - ival = rb_str_to_str(ival); | |
166 | + ival = Ruby_ObjToStringObj(ival); | |
154 | 167 | s = RSTRING_PTR(ival); |
155 | 168 | if (strncmp(s, "info", 4) == 0) |
156 | 169 | icon = 1; |
@@ -1845,8 +1858,8 @@ static VALUE s_ParameterRef_SetWeight(VALUE self, VALUE val) { | ||
1845 | 1858 | VALUE oldval; |
1846 | 1859 | val = rb_Float(val); |
1847 | 1860 | oldval = s_ParameterRef_GetWeight(self); |
1848 | - oldsrc = up->bond.src; | |
1849 | 1861 | up = s_UnionParFromValue(self, &tp, 1); |
1862 | + oldsrc = up->bond.src; | |
1850 | 1863 | if (tp == kElementParType) |
1851 | 1864 | up->atom.weight = NUM2DBL(val); |
1852 | 1865 | else if (tp == kVdwParType) |
@@ -4515,26 +4528,38 @@ s_Molecule_Inspect(VALUE self) | ||
4515 | 4528 | |
4516 | 4529 | /* |
4517 | 4530 | * call-seq: |
4531 | + * open -> Molecule | |
4518 | 4532 | * open(file) -> Molecule |
4519 | 4533 | * |
4520 | - * Create a new molecule from file. | |
4534 | + * Create a new molecule from file as a document. If file is not given, an untitled document is created. | |
4521 | 4535 | */ |
4522 | 4536 | static VALUE |
4523 | -s_Molecule_Open(VALUE self, VALUE fname) | |
4537 | +s_Molecule_Open(int argc, VALUE *argv, VALUE self) | |
4524 | 4538 | { |
4525 | - const char *p = FileStringValuePtr(fname); | |
4539 | + VALUE fname; | |
4540 | + const char *p; | |
4526 | 4541 | Molecule *mp; |
4527 | 4542 | VALUE iflag; |
4543 | + rb_scan_args(argc, argv, "01", &fname); | |
4544 | + if (NIL_P(fname)) | |
4545 | + p = NULL; | |
4546 | + else | |
4547 | + p = FileStringValuePtr(fname); | |
4528 | 4548 | iflag = Ruby_SetInterruptFlag(Qfalse); |
4529 | 4549 | mp = MoleculeCallback_openNewMolecule(p); |
4530 | 4550 | Ruby_SetInterruptFlag(iflag); |
4531 | - if (mp == NULL) | |
4532 | - rb_raise(rb_eMolbyError, "Cannot open the file %s", p); | |
4551 | + if (mp == NULL) { | |
4552 | + if (p == NULL) | |
4553 | + rb_raise(rb_eMolbyError, "Cannot create untitled document"); | |
4554 | + else | |
4555 | + rb_raise(rb_eMolbyError, "Cannot open the file %s", p); | |
4556 | + } | |
4533 | 4557 | return ValueFromMolecule(mp); |
4534 | 4558 | } |
4535 | 4559 | |
4536 | 4560 | /* |
4537 | 4561 | * call-seq: |
4562 | + * new -> Molecule | |
4538 | 4563 | * new(file, *args) -> Molecule |
4539 | 4564 | * |
4540 | 4565 | * Create a new molecule and call "load" method with the same arguments. |
@@ -4544,7 +4569,7 @@ s_Molecule_Initialize(int argc, VALUE *argv, VALUE self) | ||
4544 | 4569 | { |
4545 | 4570 | if (argc > 0) |
4546 | 4571 | return s_Molecule_Load(argc, argv, self); |
4547 | - else return Qnil; | |
4572 | + else return Qnil; /* An empty molecule (which is prepared in s_Molecule_Alloc()) is returned */ | |
4548 | 4573 | } |
4549 | 4574 | |
4550 | 4575 | static VALUE |
@@ -7361,6 +7386,22 @@ s_Molecule_LineMode(int argc, VALUE *argv, VALUE self) | ||
7361 | 7386 | |
7362 | 7387 | /* |
7363 | 7388 | * call-seq: |
7389 | + * resize_to_fit | |
7390 | + * | |
7391 | + * Resize the model drawing to fit in the window. | |
7392 | + */ | |
7393 | +static VALUE | |
7394 | +s_Molecule_ResizeToFit(VALUE self) | |
7395 | +{ | |
7396 | + Molecule *mol; | |
7397 | + Data_Get_Struct(self, Molecule, mol); | |
7398 | + if (mol->mview != NULL) | |
7399 | + MainView_resizeToFit(mol->mview); | |
7400 | + return self; | |
7401 | +} | |
7402 | + | |
7403 | +/* | |
7404 | + * call-seq: | |
7364 | 7405 | * show_text(string) |
7365 | 7406 | * |
7366 | 7407 | * Show the string in the info text box. |
@@ -7934,6 +7975,7 @@ Init_Molby(void) | ||
7934 | 7975 | rb_define_alias(rb_cMolecule, "show_periodic_image=", "show_periodic_image"); |
7935 | 7976 | rb_define_method(rb_cMolecule, "line_mode", s_Molecule_LineMode, -1); |
7936 | 7977 | rb_define_alias(rb_cMolecule, "line_mode=", "line_mode"); |
7978 | + rb_define_method(rb_cMolecule, "resize_to_fit", s_Molecule_ResizeToFit, 0); | |
7937 | 7979 | rb_define_method(rb_cMolecule, "show_text", s_Molecule_ShowText, 1); |
7938 | 7980 | rb_define_method(rb_cMolecule, "md_arena", s_Molecule_MDArena, 0); |
7939 | 7981 | rb_define_method(rb_cMolecule, "set_parameter_attr", s_Molecule_SetParameterAttr, 5); |
@@ -7947,7 +7989,7 @@ Init_Molby(void) | ||
7947 | 7989 | |
7948 | 7990 | rb_define_singleton_method(rb_cMolecule, "current", s_Molecule_Current, 0); |
7949 | 7991 | rb_define_singleton_method(rb_cMolecule, "[]", s_Molecule_MoleculeAtIndex, -1); |
7950 | - rb_define_singleton_method(rb_cMolecule, "open", s_Molecule_Open, 1); | |
7992 | + rb_define_singleton_method(rb_cMolecule, "open", s_Molecule_Open, -1); | |
7951 | 7993 | rb_define_singleton_method(rb_cMolecule, "list", s_Molecule_List, 0); |
7952 | 7994 | rb_define_singleton_method(rb_cMolecule, "ordered_list", s_Molecule_OrderedList, 0); |
7953 | 7995 |
@@ -5,7 +5,7 @@ | ||
5 | 5 | An Interactive Molecular Modeling Software |
6 | 6 | with Integrated Ruby Interpreter |
7 | 7 | |
8 | - Version 0.5.5 build 20110702 | |
8 | + Version 0.5.5 build 20110721 | |
9 | 9 | |
10 | 10 | Toshi Nagata |
11 | 11 |
@@ -513,7 +513,7 @@ class Molecule | ||
513 | 513 | when /^BOND/ |
514 | 514 | state = 2 |
515 | 515 | next |
516 | - when /^ANGLE/ | |
516 | + when /^ANGL/ | |
517 | 517 | state = 3 |
518 | 518 | next |
519 | 519 | when /^DIHE/ |
@@ -534,21 +534,21 @@ class Molecule | ||
534 | 534 | name, weight = s.split |
535 | 535 | wtable[name] = Float(weight) |
536 | 536 | when 2 |
537 | - types, k, r0, com = s.split(/ +/, 4) | |
537 | + types, k, r0, com = s.split(" ", 4) | |
538 | 538 | pp = par.bonds.lookup(types, :local, :missing) || par.bonds.insert |
539 | 539 | pp.atom_types = types |
540 | 540 | pp.k = k |
541 | 541 | pp.r0 = r0 |
542 | 542 | pp.comment = com |
543 | 543 | when 3 |
544 | - types, k, a0, com = s.split(/ +/, 4) | |
544 | + types, k, a0, com = s.split(" ", 4) | |
545 | 545 | pp = par.angles.lookup(types, :local, :missing) || par.angles.insert |
546 | 546 | pp.atom_types = types |
547 | 547 | pp.k = k |
548 | 548 | pp.a0 = a0 |
549 | 549 | pp.comment = com |
550 | 550 | when 4 |
551 | - types, n, k, phi0, period, com = s.split(/ +/, 6) | |
551 | + types, n, k, phi0, period, com = s.split(" ", 6) | |
552 | 552 | pp = par.dihedrals.lookup(types, :local, :missing) || par.dihedrals.insert |
553 | 553 | pp.atom_types = types |
554 | 554 | pp.mult = 1 |
@@ -557,7 +557,7 @@ class Molecule | ||
557 | 557 | pp.period = Float(period).round |
558 | 558 | pp.comment = com |
559 | 559 | when 5 |
560 | - types, k, phi0, period, com = s.split(/ +/, 5) | |
560 | + types, k, phi0, period, com = s.split(" ", 5) | |
561 | 561 | pp = par.impropers.lookup(types, :local, :missing) || par.impropers.insert |
562 | 562 | pp.atom_types = types |
563 | 563 | pp.mult = 1 |
@@ -566,7 +566,7 @@ class Molecule | ||
566 | 566 | pp.period = Float(period).round |
567 | 567 | pp.comment = com |
568 | 568 | when 6 |
569 | - name, r_eq, eps, com = s.split(/ +/, 4) | |
569 | + name, r_eq, eps, com = s.split(" ", 4) | |
570 | 570 | pp = par.vdws.lookup(name, :local, :missing) || par.vdws.insert |
571 | 571 | pp.atom_type = name |
572 | 572 | pp.r_eq = r_eq |
@@ -583,6 +583,126 @@ class Molecule | ||
583 | 583 | } |
584 | 584 | end |
585 | 585 | |
586 | + def Molecule.import_amberlib(file) | |
587 | + fp = File.open(file, "r") | |
588 | + raise MolbyError, "Cannot open file #{file}" if fp == nil | |
589 | + mols = Hash.new | |
590 | + while line = fp.gets | |
591 | + if line =~ /^!!index/ | |
592 | + while line = fp.gets | |
593 | + break if line =~ /^!/ | |
594 | + units = line.scan(/"([^\"]*)"/).flatten | |
595 | + end | |
596 | + elsif line =~ /^!entry\.(\w+)\.unit\.(\w+)\s/ | |
597 | + unit = $1 | |
598 | + cmd = $2 | |
599 | + mol = (mols[unit] ||= Molecule.new) | |
600 | + if cmd == "atoms" | |
601 | + while line = fp.gets | |
602 | + break if line =~ /^!/ | |
603 | + line.chomp! | |
604 | + en = line.split | |
605 | + en[0].delete!("\"") | |
606 | + en[1].delete!("\"") | |
607 | + ap = mol.add_atom(en[0], en[1]) | |
608 | + elem = Integer(en[6]) | |
609 | + if elem > 0 | |
610 | + ap.atomic_number = elem | |
611 | + else | |
612 | + ap.element = en[1][0, 1].upcase | |
613 | + end | |
614 | + ap.charge = Float(en[7]) | |
615 | + end | |
616 | + elsif cmd == "boundbox" | |
617 | + values = [] | |
618 | + 5.times { values.push(Float(fp.gets)) } | |
619 | + mol.set_cell([values[2], values[3], values[4], 90, 90, 90]) | |
620 | + line = fp.gets | |
621 | + elsif cmd == "connectivity" | |
622 | + while line = fp.gets | |
623 | + break if line =~ /^!/ | |
624 | + line.chomp! | |
625 | + con = line.split | |
626 | + begin | |
627 | + mol.create_bond(Integer(con[0]) - 1, Integer(con[1]) - 1) | |
628 | + rescue | |
629 | + puts "#{$!}: con[0] = #{con[0]}, con[1] = #{con[1]}" | |
630 | + p "natoms = #{mol.natoms}" | |
631 | + raise | |
632 | + end | |
633 | + end | |
634 | + elsif cmd == "positions" | |
635 | + index = 0 | |
636 | + while line = fp.gets | |
637 | + break if line =~ /^!/ | |
638 | + line.chomp! | |
639 | + pos = line.split | |
640 | + mol.atoms[index].r = [Float(pos[0]), Float(pos[1]), Float(pos[2])] | |
641 | + index += 1 | |
642 | + end | |
643 | + elsif cmd == "residues" | |
644 | + resseq = 0 | |
645 | + name = nil | |
646 | + n1 = 0 | |
647 | + while line = fp.gets | |
648 | + if line =~ /^!/ | |
649 | + values[0] = nil | |
650 | + values[3] = mol.natoms + 1 | |
651 | + else | |
652 | + values = line.split | |
653 | + values[0].delete!("\"") | |
654 | + values[3] = Integer(values[3]) | |
655 | + end | |
656 | + if name | |
657 | + mol.assign_residue(IntGroup[n1..values[3] - 2], sprintf("%s.%d", name, resseq)) | |
658 | + end | |
659 | + name = values[0] | |
660 | + n1 = values[3] - 1 | |
661 | + resseq += 1 | |
662 | + break if name == nil | |
663 | + end | |
664 | + else | |
665 | + while line = fp.gets | |
666 | + break if line =~ /^!/ | |
667 | + end | |
668 | + end | |
669 | + end | |
670 | + redo if line | |
671 | + end | |
672 | + fp.close | |
673 | + msg = "Imported unit(s):" | |
674 | + mols.each { |key, val| | |
675 | + mol = Molecule.open | |
676 | + mol.add(val) | |
677 | + if val.cell != nil | |
678 | + mol.set_cell(val.cell) | |
679 | + end | |
680 | + if mol.natoms > 1000 | |
681 | + mol.line_mode(true) | |
682 | + end | |
683 | + mol.resize_to_fit | |
684 | + msg += "\n #{key} (#{mol.name})" | |
685 | + if mol.md_arena.prepare(true) == nil | |
686 | + h = Dialog.run("Missing parameters") { | |
687 | + layout(1, item(:text, :title=>"Some parameters are missing for unit \"#{key}\". Do you want to import an frcmod file?")) | |
688 | + } | |
689 | + if (h[:status] == 0) | |
690 | + file = Dialog.open_panel("Select frcmod file", nil, "AMBER frcmod (*.frcmod)|*.frcmod|All Files (*.*)|*.*") | |
691 | + if file | |
692 | + mol.instance_eval { import_frcmod(file) } | |
693 | + end | |
694 | + end | |
695 | + end | |
696 | + } | |
697 | + message_box(msg, "AMBER Lib Import Complete", :ok) | |
698 | + puts msg | |
699 | + end | |
700 | + | |
701 | + def Molecule.cmd_import_amberlib | |
702 | + file = Dialog.open_panel("Select AMBER lib file", nil, "AMBER lib file (*.lib)|*.lib|All Files (*.*)|*.*") | |
703 | + import_amberlib(file) | |
704 | + end | |
705 | + | |
586 | 706 | def export_ac(acfile) |
587 | 707 | open(acfile, "w") { |fp| |
588 | 708 | charge = 0.0 |
@@ -514,6 +514,8 @@ class Molecule | ||
514 | 514 | raise MolbyError, "the solvent box does not have three-dimensional periodicity" |
515 | 515 | end |
516 | 516 | |
517 | + show_progress_panel("Adding a solvent box...") | |
518 | + | |
517 | 519 | # Calculate the box size |
518 | 520 | b = self.bounds |
519 | 521 | bsize = b[1] - b[0] |
@@ -536,6 +538,7 @@ class Molecule | ||
536 | 538 | solute_natoms = self.natoms |
537 | 539 | |
538 | 540 | # Add solvents so that the target box is fully covered |
541 | + set_progress_message("Duplicating the solvent box...") | |
539 | 542 | rtr = sbox.cell_transform.inverse |
540 | 543 | min = Vector3D[1e30, 1e30, 1e30] |
541 | 544 | max = Vector3D[-1e30, -1e30, -1e30] |
@@ -559,25 +562,32 @@ class Molecule | ||
559 | 562 | xv, yv, zv, ov, flags = sbox.box |
560 | 563 | # puts "xmin = #{xmin}, ymin = #{ymin}, zmin = #{zmin}" |
561 | 564 | # puts "xmax = #{xmax}, ymax = #{ymax}, zmax = #{zmax}" |
565 | + newbox = Molecule.new | |
562 | 566 | (xmin..xmax).each do |x| |
563 | 567 | (ymin..ymax).each do |y| |
564 | 568 | (zmin..zmax).each do |z| |
565 | - add(sbox) | |
566 | - translate(xv * x + yv * y + zv * z, IntGroup[self.natoms - sbox_natoms..self.natoms - 1]) | |
569 | + newbox.add(sbox) | |
570 | + newbox.translate(xv * x + yv * y + zv * z, IntGroup[newbox.natoms - sbox_natoms..newbox.natoms - 1]) | |
567 | 571 | end |
568 | 572 | end |
569 | 573 | end |
570 | 574 | |
571 | 575 | # Remove out-of-bounds molecules |
572 | - g = atom_group do |ap| | |
576 | + set_progress_message("Removing out-of-bounds molecules...") | |
577 | + g = newbox.atom_group do |ap| | |
573 | 578 | r = ap.r |
574 | 579 | r.x < -bsize[0] * 0.5 || r.y < -bsize[1] * 0.5 || r.z < -bsize[2] * 0.5 || r.x > bsize[0] * 0.5 || r.y > bsize[1] * 0.5 || r.z > bsize[2] * 0.5 |
575 | 580 | end |
576 | - g = fragment(g) # expand by fragment | |
577 | - remove(g) | |
581 | + g = newbox.fragment(g) # expand by fragment | |
582 | + newbox.remove(g) | |
583 | + | |
584 | + # Add solvent molecules | |
585 | + self.line_mode(true) | |
586 | + self.add(newbox) | |
578 | 587 | # puts "Removed atoms by bounds: #{g}" |
579 | 588 | |
580 | 589 | # Find conflicts |
590 | + set_progress_message("Removing conflicting molecules...") | |
581 | 591 | conf = find_conflicts(limit, IntGroup[0..solute_natoms - 1], IntGroup[solute_natoms..self.natoms - 1]) |
582 | 592 | g = atom_group(conf.map { |c| c[1] } ) # atom group containing conflicting atoms |
583 | 593 | g = fragment(g) # expand by fragment |
@@ -603,6 +613,9 @@ class Molecule | ||
603 | 613 | # Set the unit cell information |
604 | 614 | set_box(bsize[0], bsize[1], bsize[2]) |
605 | 615 | |
616 | + hide_progress_panel | |
617 | + resize_to_fit | |
618 | + | |
606 | 619 | return IntGroup[solute_natoms..self.natoms - 1] |
607 | 620 | |
608 | 621 | end |
@@ -1,2 +1,2 @@ | ||
1 | 1 | version = "0.5.5" |
2 | -date = "20110702" | |
2 | +date = "20110721" |
@@ -1,6 +1,6 @@ | ||
1 | 1 | [Setup] |
2 | 2 | AppName = Molby |
3 | -AppVerName = Molby (v0.5.5 build 20110702) | |
3 | +AppVerName = Molby (v0.5.5 build 20110721) | |
4 | 4 | DefaultDirName = {pf}\Molby |
5 | 5 | DefaultGroupName = Molby |
6 | 6 | UninstallDisplayIcon = {app}\Molby.exe |
@@ -81,6 +81,7 @@ BEGIN_EVENT_TABLE(MyApp, wxApp) | ||
81 | 81 | // EVT_MENU(myMenuID_ReadParameters, MyApp::OnReadParameters) |
82 | 82 | EVT_MENU(myMenuID_ViewGlobalParameters, MyApp::OnViewGlobalParameters) |
83 | 83 | EVT_MENU(myMenuID_ViewParameterFilesList, MyApp::OnViewParameterFilesList) |
84 | + EVT_MENU(myMenuID_ImportAmberLib, MyApp::OnImportAmberLib) | |
84 | 85 | #if defined(__WXMAC__) |
85 | 86 | EVT_ACTIVATE(MyApp::OnActivate) |
86 | 87 | #endif |
@@ -396,6 +397,7 @@ MyApp::CreateMenuBar(int kind, wxMenu **out_file_history_menu, wxMenu **out_edit | ||
396 | 397 | md_tools_menu->Append(myMenuID_RunAntechamber, _T("Antechamber/parmchk...")); |
397 | 398 | md_tools_menu->Append(myMenuID_RunResp, _T("GAMESS/RESP...")); |
398 | 399 | md_tools_menu->Append(myMenuID_CreateSanderInput, _T("Create SANDER input...")); |
400 | + md_tools_menu->Append(myMenuID_ImportAmberLib, _T("Import AMBER Lib...")); | |
399 | 401 | md_menu->Append(myMenuID_MDTools, _T("Tools"), md_tools_menu); |
400 | 402 | |
401 | 403 | wxMenu *qc_menu = new wxMenu; |
@@ -594,6 +596,12 @@ MyApp::OnViewParameterFilesList(wxCommandEvent &event) | ||
594 | 596 | } |
595 | 597 | |
596 | 598 | void |
599 | +MyApp::OnImportAmberLib(wxCommandEvent &event) | |
600 | +{ | |
601 | + MolActionCreateAndPerform(NULL, SCRIPT_ACTION(""), "cmd_import_amberlib"); | |
602 | +} | |
603 | + | |
604 | +void | |
597 | 605 | MyApp::RegisterScriptMenu(const char *cmd, const char *title) |
598 | 606 | { |
599 | 607 | int i; |
@@ -722,13 +730,21 @@ MyApp::OnUpdateUI(wxUpdateUIEvent& event) | ||
722 | 730 | else if (methodType == 2) /* Class method (with molecule as an only argument) */ |
723 | 731 | event.Enable(true); |
724 | 732 | } |
725 | - } else if (uid == myMenuID_ExecuteScript || uid == myMenuID_OpenConsoleWindow || uid == myMenuID_ViewParameterFilesList || uid == myMenuID_ViewGlobalParameters) { | |
726 | - event.Enable(true); | |
727 | 733 | } else { |
728 | - if (mview == NULL) | |
729 | - event.Enable(false); | |
730 | - else | |
731 | - event.Skip(); | |
734 | + switch (uid) { | |
735 | + case myMenuID_ExecuteScript: | |
736 | + case myMenuID_OpenConsoleWindow: | |
737 | + case myMenuID_ViewParameterFilesList: | |
738 | + case myMenuID_ViewGlobalParameters: | |
739 | + case myMenuID_MDTools: | |
740 | + case myMenuID_ImportAmberLib: | |
741 | + event.Enable(true); | |
742 | + return; | |
743 | + default: | |
744 | + if (mview == NULL) | |
745 | + event.Enable(false); | |
746 | + else event.Skip(); | |
747 | + } | |
732 | 748 | } |
733 | 749 | } |
734 | 750 |
@@ -84,6 +84,7 @@ enum { | ||
84 | 84 | myMenuID_RunAntechamber = 152, |
85 | 85 | myMenuID_RunResp = 153, |
86 | 86 | myMenuID_CreateSanderInput = 154, |
87 | + myMenuID_ImportAmberLib = 155, | |
87 | 88 | myMenuID_CreateGamessInput = 160, |
88 | 89 | myMenuID_CreateMOCube = 161, |
89 | 90 | myMenuID_ExecuteScript = 200, |
@@ -146,6 +147,8 @@ class MyApp: public wxApp | ||
146 | 147 | void OnViewGlobalParameters(wxCommandEvent &event); |
147 | 148 | void OnViewParameterFilesList(wxCommandEvent &event); |
148 | 149 | |
150 | + void OnImportAmberLib(wxCommandEvent &event); | |
151 | + | |
149 | 152 | void OnEndProcess(wxProcessEvent &event); |
150 | 153 | int CallSubProcess(const char *cmdline, const char *procname); |
151 | 154 |
@@ -1283,6 +1283,13 @@ MyDocument::OnUpdateUI(wxUpdateUIEvent& event) | ||
1283 | 1283 | case myMenuID_ShowPeriodicImage: |
1284 | 1284 | event.Enable(true); |
1285 | 1285 | return; |
1286 | + case myMenuID_RunAntechamber: | |
1287 | + case myMenuID_RunResp: | |
1288 | + case myMenuID_CreateSanderInput: | |
1289 | + if (mol != NULL && mol->natoms > 0) | |
1290 | + event.Enable(true); | |
1291 | + else event.Enable(false); | |
1292 | + return; | |
1286 | 1293 | case myMenuID_CreateGamessInput: |
1287 | 1294 | if (mol != NULL && mol->natoms > 0) |
1288 | 1295 | event.Enable(true); |
@@ -15,5 +15,5 @@ | ||
15 | 15 | GNU General Public License for more details. |
16 | 16 | */ |
17 | 17 | |
18 | -const char *gVersionString = "v0.5.5 build 20110702"; | |
18 | +const char *gVersionString = "v0.5.5 build 20110721"; | |
19 | 19 | const char *gCopyrightString = "Copyright (c) 2008-2011 Toshi Nagata"; |
@@ -36,6 +36,6 @@ | ||
36 | 36 | <key>CFBundleSignature</key> |
37 | 37 | <string>????</string> |
38 | 38 | <key>CFBundleVersion</key> |
39 | - <string>v0.5.5 build 20110702</string> | |
39 | + <string>v0.5.5 build 20110721</string> | |
40 | 40 | </dict> |
41 | 41 | </plist> |