digichem-core 6.0.0rc1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. digichem/__init__.py +75 -0
  2. digichem/basis.py +116 -0
  3. digichem/config/README +3 -0
  4. digichem/config/__init__.py +5 -0
  5. digichem/config/base.py +321 -0
  6. digichem/config/locations.py +14 -0
  7. digichem/config/parse.py +90 -0
  8. digichem/config/util.py +117 -0
  9. digichem/data/README +4 -0
  10. digichem/data/batoms/COPYING +18 -0
  11. digichem/data/batoms/LICENSE +674 -0
  12. digichem/data/batoms/README +2 -0
  13. digichem/data/batoms/__init__.py +0 -0
  14. digichem/data/batoms/batoms-renderer.py +351 -0
  15. digichem/data/config/digichem.yaml +714 -0
  16. digichem/data/functionals.csv +15 -0
  17. digichem/data/solvents.csv +185 -0
  18. digichem/data/tachyon/COPYING.md +5 -0
  19. digichem/data/tachyon/LICENSE +30 -0
  20. digichem/data/tachyon/tachyon_LINUXAMD64 +0 -0
  21. digichem/data/vmd/common.tcl +468 -0
  22. digichem/data/vmd/generate_combined_orbital_images.tcl +70 -0
  23. digichem/data/vmd/generate_density_images.tcl +45 -0
  24. digichem/data/vmd/generate_dipole_images.tcl +68 -0
  25. digichem/data/vmd/generate_orbital_images.tcl +57 -0
  26. digichem/data/vmd/generate_spin_images.tcl +66 -0
  27. digichem/data/vmd/generate_structure_images.tcl +40 -0
  28. digichem/datas.py +14 -0
  29. digichem/exception/__init__.py +7 -0
  30. digichem/exception/base.py +133 -0
  31. digichem/exception/uncatchable.py +63 -0
  32. digichem/file/__init__.py +1 -0
  33. digichem/file/base.py +364 -0
  34. digichem/file/cube.py +284 -0
  35. digichem/file/fchk.py +94 -0
  36. digichem/file/prattle.py +277 -0
  37. digichem/file/types.py +97 -0
  38. digichem/image/__init__.py +6 -0
  39. digichem/image/base.py +113 -0
  40. digichem/image/excited_states.py +335 -0
  41. digichem/image/graph.py +293 -0
  42. digichem/image/orbitals.py +239 -0
  43. digichem/image/render.py +617 -0
  44. digichem/image/spectroscopy.py +797 -0
  45. digichem/image/structure.py +115 -0
  46. digichem/image/vmd.py +826 -0
  47. digichem/input/__init__.py +3 -0
  48. digichem/input/base.py +78 -0
  49. digichem/input/digichem_input.py +500 -0
  50. digichem/input/gaussian.py +140 -0
  51. digichem/log.py +179 -0
  52. digichem/memory.py +166 -0
  53. digichem/misc/__init__.py +4 -0
  54. digichem/misc/argparse.py +44 -0
  55. digichem/misc/base.py +61 -0
  56. digichem/misc/io.py +239 -0
  57. digichem/misc/layered_dict.py +285 -0
  58. digichem/misc/text.py +139 -0
  59. digichem/misc/time.py +73 -0
  60. digichem/parse/__init__.py +13 -0
  61. digichem/parse/base.py +220 -0
  62. digichem/parse/cclib.py +138 -0
  63. digichem/parse/dump.py +253 -0
  64. digichem/parse/gaussian.py +130 -0
  65. digichem/parse/orca.py +96 -0
  66. digichem/parse/turbomole.py +201 -0
  67. digichem/parse/util.py +523 -0
  68. digichem/result/__init__.py +6 -0
  69. digichem/result/alignment/AA.py +114 -0
  70. digichem/result/alignment/AAA.py +61 -0
  71. digichem/result/alignment/FAP.py +148 -0
  72. digichem/result/alignment/__init__.py +3 -0
  73. digichem/result/alignment/base.py +310 -0
  74. digichem/result/angle.py +153 -0
  75. digichem/result/atom.py +742 -0
  76. digichem/result/base.py +258 -0
  77. digichem/result/dipole_moment.py +332 -0
  78. digichem/result/emission.py +402 -0
  79. digichem/result/energy.py +323 -0
  80. digichem/result/excited_state.py +821 -0
  81. digichem/result/ground_state.py +94 -0
  82. digichem/result/metadata.py +644 -0
  83. digichem/result/multi.py +98 -0
  84. digichem/result/nmr.py +1086 -0
  85. digichem/result/orbital.py +647 -0
  86. digichem/result/result.py +244 -0
  87. digichem/result/soc.py +272 -0
  88. digichem/result/spectroscopy.py +514 -0
  89. digichem/result/tdm.py +267 -0
  90. digichem/result/vibration.py +167 -0
  91. digichem/test/__init__.py +6 -0
  92. digichem/test/conftest.py +4 -0
  93. digichem/test/test_basis.py +71 -0
  94. digichem/test/test_calculate.py +30 -0
  95. digichem/test/test_config.py +78 -0
  96. digichem/test/test_cube.py +369 -0
  97. digichem/test/test_exception.py +16 -0
  98. digichem/test/test_file.py +104 -0
  99. digichem/test/test_image.py +337 -0
  100. digichem/test/test_input.py +64 -0
  101. digichem/test/test_parsing.py +79 -0
  102. digichem/test/test_prattle.py +36 -0
  103. digichem/test/test_result.py +489 -0
  104. digichem/test/test_translate.py +112 -0
  105. digichem/test/util.py +207 -0
  106. digichem/translate.py +591 -0
  107. digichem_core-6.0.0rc1.dist-info/METADATA +96 -0
  108. digichem_core-6.0.0rc1.dist-info/RECORD +111 -0
  109. digichem_core-6.0.0rc1.dist-info/WHEEL +4 -0
  110. digichem_core-6.0.0rc1.dist-info/licenses/COPYING.md +10 -0
  111. digichem_core-6.0.0rc1.dist-info/licenses/LICENSE +11 -0
@@ -0,0 +1,117 @@
1
+ from deepmerge import Merger
2
+
3
+ from digichem.config.base import Digichem_options
4
+ from digichem.config.parse import Config_file_parser, Config_parser
5
+ from digichem.config.locations import master_config_path, system_config_location, user_config_location
6
+
7
+ from digichem.log import get_logger
8
+
9
+
10
+ # The main digichem options object.
11
+ # When running as a program, this will be merged with run-time options.
12
+ _options = None
13
+
14
+ def get_config(
15
+ extra_config_files = None,
16
+ extra_config_strings = None,
17
+ cls = Digichem_options,
18
+ clear_cache = False,
19
+ sources = (
20
+ master_config_path,
21
+ system_config_location,
22
+ user_config_location
23
+ )
24
+ ):
25
+ """
26
+ Get a Digichem options object.
27
+
28
+ The returned object will take options from three sources:
29
+ 1) Any config files found in the default locations (see digichem.config.locations).
30
+ 2) Any additional config files specified as an argument.
31
+ 3) Any additional config strings specified as an argument.
32
+
33
+ IMPORTANT: The returned options object will be merged with any additional options without prior copying.
34
+ Hence the object returned by this function will be the same as the options attribute of this module.
35
+
36
+ :param extra_config_files: An iterable of additional file paths to read from.
37
+ :param extra_config_strings: An iterable of additional config options to parse.
38
+ :param cls: The type of object to return.
39
+ :param clear_cache: If True, and previously cached options will be discarded.
40
+ :param sources: An iterable of file locations to read from.
41
+ :return: A Digichem_options object (a fancy dict).
42
+ """
43
+ if clear_cache:
44
+ globals()['_options'] = None
45
+
46
+ if _options is not None and extra_config_files is None and extra_config_strings is None:
47
+ # Config has already been loaded (and we have nothing new to add).
48
+ # Return the config object.
49
+ return _options
50
+
51
+ # Either this is the first time we've loaded the config (cache miss)
52
+ # or we've been given extra options to add in.
53
+ log_level = get_logger().level
54
+ get_logger().setLevel("DEBUG")
55
+
56
+ # First, load options if not already done so.
57
+ if _options is None:
58
+ # Load config options from given sources.
59
+ # These objects are simple dicts.
60
+ config = Config_file_parser(sources[0]).load(True)
61
+ for source in sources[1:]:
62
+ merge_dict(Config_file_parser(source).load(True), config)
63
+ # config.merge(Config_file_parser(source).load(True))
64
+
65
+ # No need to validate here, we're going to do it later anyway.
66
+ globals()['_options'] = cls(validate_now = False, **config)
67
+
68
+ if extra_config_files is None:
69
+ extra_config_files = []
70
+
71
+ if extra_config_strings is None:
72
+ extra_config_strings = []
73
+
74
+ # Load any additional config files.
75
+ for extra_config_file in extra_config_files:
76
+ _options.deep_merge(Config_file_parser(extra_config_file).load())
77
+
78
+ # Then load any additional config strings.
79
+ for extra_config_string in extra_config_strings:
80
+ _options.deep_merge(Config_parser(extra_config_string).load())
81
+
82
+ # Check everything is valid.
83
+ _options.validate()
84
+
85
+ # Only restore log level if there was no problem.
86
+ get_logger().setLevel(log_level)
87
+
88
+ # And return.
89
+ return _options
90
+
91
+ def merge_dict(new, old):
92
+ """
93
+ Recursively merge two dictionaries
94
+
95
+ Any keys specified in new will overwrite those specified in old.
96
+
97
+ :param new: A new dictionary to merge into the old.
98
+ :param old: An old dictionary to be overwritten by new.
99
+ """
100
+ # Taken from deepmerge docs: https://deepmerge.readthedocs.io/en/latest/
101
+ merger = Merger(
102
+ # pass in a list of tuple, with the
103
+ # strategies you are looking to apply
104
+ # to each type.
105
+ [
106
+ (list, ["override"]),
107
+ (dict, ["merge"]),
108
+ (set, ["union"])
109
+ ],
110
+ # next, choose the fallback strategies,
111
+ # applied to all other types:
112
+ ["override"],
113
+ # finally, choose the strategies in
114
+ # the case where the types conflict:
115
+ ["override"]
116
+ )
117
+ return merger.merge(old, new)
digichem/data/README ADDED
@@ -0,0 +1,4 @@
1
+ Solvent definitions are taken from the following sources.
2
+
3
+ - Dielectric Constants: Gaussian 16 https://gaussian.com/scrf/
4
+ - Refractive Indices: ORCA https://www.orcasoftware.de/tutorials_orca/prop/CPCM.html
@@ -0,0 +1,18 @@
1
+ This license applies only to to the digichem/data/batoms directory.
2
+ Please see digichem/COPYING for full licensing information.
3
+
4
+ digichem.data.batoms: scripts for driving the beautiful atoms blender plugin
5
+ Copyright (C) 2024 Digichem
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see <https://www.gnu.org/licenses/>.