Molecular Modeling Software
リビジョン | ffed1e9b988eda46e7bf88d8a95752c155b3a099 (tree) |
---|---|
日時 | 2021-12-23 23:54:23 |
作者 | Toshi Nagata <alchemist.2005@nift...> |
コミッター | Toshi Nagata |
Import CIF is improved (newer CIF can now be read)
@@ -835,6 +835,7 @@ end_of_header | ||
835 | 835 | while true |
836 | 836 | warn_message = "" |
837 | 837 | verbose = nil |
838 | + verbose = true | |
838 | 839 | bond_defined = false |
839 | 840 | special_positions = [] |
840 | 841 | mol.remove(All) |
@@ -845,11 +846,9 @@ end_of_header | ||
845 | 846 | calculated_atoms = [] |
846 | 847 | while token != nil |
847 | 848 | if token =~ /^\#data_/i |
848 | - if token.casecmp("#data_global") == 0 | |
849 | - token = getciftoken(fp) | |
850 | - next | |
851 | - elsif data_identifier == nil | |
852 | - # Continue processing of this molecule | |
849 | + if data_identifier == nil || mol.natoms == 0 | |
850 | + # First block or no atoms yet | |
851 | + # Continue processing of this molecule | |
853 | 852 | data_identifier = token |
854 | 853 | token = getciftoken(fp) |
855 | 854 | next |
@@ -875,9 +874,9 @@ end_of_header | ||
875 | 874 | end |
876 | 875 | if cell.length == 12 && cell.all? |
877 | 876 | mol.cell = cell |
878 | - puts "Unit cell is set to #{cell.inspect}." if verbose | |
877 | + puts "Unit cell is set to #{mol.cell.inspect}." if verbose | |
879 | 878 | cell = [] |
880 | - cell_trans = self.cell_transform | |
879 | + cell_trans = mol.cell_transform | |
881 | 880 | cell_trans_inv = cell_trans.inverse |
882 | 881 | end |
883 | 882 | token = getciftoken(fp) |
@@ -887,7 +886,7 @@ end_of_header | ||
887 | 886 | while (token = getciftoken(fp)) && token[0] == ?_ |
888 | 887 | labels.push(token) |
889 | 888 | end |
890 | - if labels[0] =~ /symmetry_equiv_pos|atom_site_label|atom_site_aniso_label|geom_bond/ | |
889 | + if labels[0] =~ /symmetry_equiv_pos|space_group_symop|atom_site_label|atom_site_aniso_label|geom_bond/ | |
891 | 890 | hlabel = Hash.new(-10000000) |
892 | 891 | labels.each_with_index { |lb, i| |
893 | 892 | hlabel[lb] = i |
@@ -904,9 +903,9 @@ end_of_header | ||
904 | 903 | end |
905 | 904 | token = getciftoken(fp) |
906 | 905 | end |
907 | - if labels[0] =~ /^_symmetry_equiv_pos/ | |
906 | + if labels[0] =~ /^_symmetry_equiv_pos/ || labels[0] =~ /^_space_group_symop/ | |
908 | 907 | data.each { |d| |
909 | - symstr = d[hlabel["_symmetry_equiv_pos_as_xyz"]] | |
908 | + symstr = d[hlabel["_symmetry_equiv_pos_as_xyz"]] || d[hlabel["_space_group_symop_operation_xyz"]] | |
910 | 909 | symstr.delete("\"\'") |
911 | 910 | exps = symstr.split(/,/) |
912 | 911 | sym = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] |
@@ -1053,7 +1052,9 @@ end_of_header | ||
1053 | 1052 | } |
1054 | 1053 | end |
1055 | 1054 | } |
1056 | - bond_defined = true | |
1055 | + if mol.nbonds > 0 | |
1056 | + bond_defined = true | |
1057 | + end | |
1057 | 1058 | puts "#{mol.nbonds} bonds are created." if verbose |
1058 | 1059 | if calculated_atoms.length > 0 |
1059 | 1060 | # Guess bonds for calculated hydrogen atoms |