genice3 3.0__tar.gz

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 (352) hide show
  1. genice3-3.0/LICENSE +21 -0
  2. genice3-3.0/PKG-INFO +176 -0
  3. genice3-3.0/README.md +114 -0
  4. genice3-3.0/dependency_engine/__init__.py +218 -0
  5. genice3-3.0/dependency_engine/__main__.py +4 -0
  6. genice3-3.0/genice3/__init__.py +22 -0
  7. genice3-3.0/genice3/_build.py +43 -0
  8. genice3-3.0/genice3/cage.py +202 -0
  9. genice3-3.0/genice3/cli/__init__.py +20 -0
  10. genice3-3.0/genice3/cli/engine.py +71 -0
  11. genice3-3.0/genice3/cli/genice.py +317 -0
  12. genice3-3.0/genice3/cli/meta_schema.py +101 -0
  13. genice3-3.0/genice3/cli/option_def.py +25 -0
  14. genice3-3.0/genice3/cli/option_parser.py +158 -0
  15. genice3-3.0/genice3/cli/options.py +755 -0
  16. genice3-3.0/genice3/cli/runner.py +323 -0
  17. genice3-3.0/genice3/cli/validator.py +180 -0
  18. genice3-3.0/genice3/exporter/_KG.py +82 -0
  19. genice3-3.0/genice3/exporter/__init__.py +7 -0
  20. genice3-3.0/genice3/exporter/_pol.py +49 -0
  21. genice3-3.0/genice3/exporter/cage_survey.py +82 -0
  22. genice3-3.0/genice3/exporter/cif.py +118 -0
  23. genice3-3.0/genice3/exporter/g.py +5 -0
  24. genice3-3.0/genice3/exporter/gromacs.py +170 -0
  25. genice3-3.0/genice3/exporter/lammps.py +192 -0
  26. genice3-3.0/genice3/exporter/lmp.py +5 -0
  27. genice3-3.0/genice3/exporter/plotly.py +169 -0
  28. genice3-3.0/genice3/exporter/py.py +11 -0
  29. genice3-3.0/genice3/exporter/python.py +304 -0
  30. genice3-3.0/genice3/exporter/y.py +5 -0
  31. genice3-3.0/genice3/exporter/yaplot.py +208 -0
  32. genice3-3.0/genice3/genice.py +1681 -0
  33. genice3-3.0/genice3/group/__init__.py +18 -0
  34. genice3-3.0/genice3/group/methyl.py +26 -0
  35. genice3-3.0/genice3/logging_config.py +180 -0
  36. genice3-3.0/genice3/mcp.py +120 -0
  37. genice3-3.0/genice3/molecule/3site.py +2 -0
  38. genice3-3.0/genice3/molecule/4site.py +2 -0
  39. genice3-3.0/genice3/molecule/5site.py +2 -0
  40. genice3-3.0/genice3/molecule/6site.py +3 -0
  41. genice3-3.0/genice3/molecule/7site.py +45 -0
  42. genice3-3.0/genice3/molecule/H2.py +22 -0
  43. genice3-3.0/genice3/molecule/NvdE.py +46 -0
  44. genice3-3.0/genice3/molecule/__init__.py +46 -0
  45. genice3-3.0/genice3/molecule/ch4.py +29 -0
  46. genice3-3.0/genice3/molecule/co2.py +18 -0
  47. genice3-3.0/genice3/molecule/empty.py +17 -0
  48. genice3-3.0/genice3/molecule/et.py +9 -0
  49. genice3-3.0/genice3/molecule/g12.py +8 -0
  50. genice3-3.0/genice3/molecule/g14.py +8 -0
  51. genice3-3.0/genice3/molecule/g15.py +8 -0
  52. genice3-3.0/genice3/molecule/g16.py +8 -0
  53. genice3-3.0/genice3/molecule/ice.py +45 -0
  54. genice3-3.0/genice3/molecule/me.py +9 -0
  55. genice3-3.0/genice3/molecule/mol.py +47 -0
  56. genice3-3.0/genice3/molecule/one.py +16 -0
  57. genice3-3.0/genice3/molecule/physical_water.py +31 -0
  58. genice3-3.0/genice3/molecule/spce.py +29 -0
  59. genice3-3.0/genice3/molecule/thf.py +43 -0
  60. genice3-3.0/genice3/molecule/tip3p.py +31 -0
  61. genice3-3.0/genice3/molecule/tip4p.py +32 -0
  62. genice3-3.0/genice3/molecule/tip4p2005.py +32 -0
  63. genice3-3.0/genice3/molecule/tip5p.py +40 -0
  64. genice3-3.0/genice3/molecule/uathf.py +34 -0
  65. genice3-3.0/genice3/molecule/uathf6.py +30 -0
  66. genice3-3.0/genice3/plugin.py +642 -0
  67. genice3-3.0/genice3/service/__init__.py +36 -0
  68. genice3-3.0/genice3/service/config.py +86 -0
  69. genice3-3.0/genice3/service/exceptions.py +38 -0
  70. genice3-3.0/genice3/service/generate.py +133 -0
  71. genice3-3.0/genice3/service/media_type.py +53 -0
  72. genice3-3.0/genice3/service/meta.py +44 -0
  73. genice3-3.0/genice3/unitcell/0.py +2 -0
  74. genice3-3.0/genice3/unitcell/11.py +2 -0
  75. genice3-3.0/genice3/unitcell/115_2_114.py +104 -0
  76. genice3-3.0/genice3/unitcell/11alt.py +176 -0
  77. genice3-3.0/genice3/unitcell/11i.py +342 -0
  78. genice3-3.0/genice3/unitcell/12.py +2 -0
  79. genice3-3.0/genice3/unitcell/12_1_11.py +110 -0
  80. genice3-3.0/genice3/unitcell/13.py +2 -0
  81. genice3-3.0/genice3/unitcell/14.py +2 -0
  82. genice3-3.0/genice3/unitcell/144_2_7301.py +88 -0
  83. genice3-3.0/genice3/unitcell/151_2_4949650.py +114 -0
  84. genice3-3.0/genice3/unitcell/153_2_155471.py +78 -0
  85. genice3-3.0/genice3/unitcell/16.py +2 -0
  86. genice3-3.0/genice3/unitcell/17.py +2 -0
  87. genice3-3.0/genice3/unitcell/176_2_5256.py +66 -0
  88. genice3-3.0/genice3/unitcell/1c.py +2 -0
  89. genice3-3.0/genice3/unitcell/1c_2_2_2.py +236 -0
  90. genice3-3.0/genice3/unitcell/1h.py +2 -0
  91. genice3-3.0/genice3/unitcell/1h_2_2_2.py +428 -0
  92. genice3-3.0/genice3/unitcell/1h_unit.py +2 -0
  93. genice3-3.0/genice3/unitcell/2.py +2 -0
  94. genice3-3.0/genice3/unitcell/207_1_4435.py +2 -0
  95. genice3-3.0/genice3/unitcell/21.py +3 -0
  96. genice3-3.0/genice3/unitcell/2D3.py +117 -0
  97. genice3-3.0/genice3/unitcell/2_2_623457.py +132 -0
  98. genice3-3.0/genice3/unitcell/2d.py +2 -0
  99. genice3-3.0/genice3/unitcell/3.py +2 -0
  100. genice3-3.0/genice3/unitcell/4.py +2 -0
  101. genice3-3.0/genice3/unitcell/5.py +2 -0
  102. genice3-3.0/genice3/unitcell/5R.py +133 -0
  103. genice3-3.0/genice3/unitcell/6.py +2 -0
  104. genice3-3.0/genice3/unitcell/6h.py +46 -0
  105. genice3-3.0/genice3/unitcell/7.py +2 -0
  106. genice3-3.0/genice3/unitcell/8.py +2 -0
  107. genice3-3.0/genice3/unitcell/9.py +2 -0
  108. genice3-3.0/genice3/unitcell/A.py +2 -0
  109. genice3-3.0/genice3/unitcell/A15.py +2 -0
  110. genice3-3.0/genice3/unitcell/ACO.py +62 -0
  111. genice3-3.0/genice3/unitcell/B.py +2 -0
  112. genice3-3.0/genice3/unitcell/BSV.py +142 -0
  113. genice3-3.0/genice3/unitcell/C14.py +2 -0
  114. genice3-3.0/genice3/unitcell/C15.py +2 -0
  115. genice3-3.0/genice3/unitcell/C36.py +2 -0
  116. genice3-3.0/genice3/unitcell/CIF.py +102 -0
  117. genice3-3.0/genice3/unitcell/CRN1.py +3052 -0
  118. genice3-3.0/genice3/unitcell/CRN2.py +3052 -0
  119. genice3-3.0/genice3/unitcell/CRN3.py +12340 -0
  120. genice3-3.0/genice3/unitcell/CS1.py +91 -0
  121. genice3-3.0/genice3/unitcell/CS2.py +182 -0
  122. genice3-3.0/genice3/unitcell/CS4.py +2 -0
  123. genice3-3.0/genice3/unitcell/DDR.py +97 -0
  124. genice3-3.0/genice3/unitcell/DOH.py +110 -0
  125. genice3-3.0/genice3/unitcell/EMT.py +124 -0
  126. genice3-3.0/genice3/unitcell/FAU.py +231 -0
  127. genice3-3.0/genice3/unitcell/FK6layers.py +2 -0
  128. genice3-3.0/genice3/unitcell/FK9layers.py +2 -0
  129. genice3-3.0/genice3/unitcell/HS1.py +131 -0
  130. genice3-3.0/genice3/unitcell/HS2.py +2 -0
  131. genice3-3.0/genice3/unitcell/HS3.py +2 -0
  132. genice3-3.0/genice3/unitcell/Hcomp.py +2 -0
  133. genice3-3.0/genice3/unitcell/II.py +2 -0
  134. genice3-3.0/genice3/unitcell/III.py +2 -0
  135. genice3-3.0/genice3/unitcell/IV.py +2 -0
  136. genice3-3.0/genice3/unitcell/IWV.py +80 -0
  137. genice3-3.0/genice3/unitcell/IX.py +2 -0
  138. genice3-3.0/genice3/unitcell/Ic.py +2 -0
  139. genice3-3.0/genice3/unitcell/Ih.py +2 -0
  140. genice3-3.0/genice3/unitcell/LTA.py +70 -0
  141. genice3-3.0/genice3/unitcell/M.py +2 -0
  142. genice3-3.0/genice3/unitcell/MAR.py +118 -0
  143. genice3-3.0/genice3/unitcell/MEP.py +2 -0
  144. genice3-3.0/genice3/unitcell/MTN.py +2 -0
  145. genice3-3.0/genice3/unitcell/NON.py +134 -0
  146. genice3-3.0/genice3/unitcell/PCOD8007225.py +105 -0
  147. genice3-3.0/genice3/unitcell/PCOD8036144.py +138 -0
  148. genice3-3.0/genice3/unitcell/PCOD8204698.py +112 -0
  149. genice3-3.0/genice3/unitcell/PCOD8301974.py +168 -0
  150. genice3-3.0/genice3/unitcell/PCOD8321499.py +78 -0
  151. genice3-3.0/genice3/unitcell/PCOD8324623.py +74 -0
  152. genice3-3.0/genice3/unitcell/RHO.py +93 -0
  153. genice3-3.0/genice3/unitcell/SGT.py +110 -0
  154. genice3-3.0/genice3/unitcell/SOD.py +57 -0
  155. genice3-3.0/genice3/unitcell/Struct01.py +1093 -0
  156. genice3-3.0/genice3/unitcell/Struct02.py +1357 -0
  157. genice3-3.0/genice3/unitcell/Struct03.py +1036 -0
  158. genice3-3.0/genice3/unitcell/Struct04.py +472 -0
  159. genice3-3.0/genice3/unitcell/Struct05.py +1429 -0
  160. genice3-3.0/genice3/unitcell/Struct06.py +1429 -0
  161. genice3-3.0/genice3/unitcell/Struct07.py +745 -0
  162. genice3-3.0/genice3/unitcell/Struct08.py +1429 -0
  163. genice3-3.0/genice3/unitcell/Struct09.py +1429 -0
  164. genice3-3.0/genice3/unitcell/Struct10.py +745 -0
  165. genice3-3.0/genice3/unitcell/Struct11.py +745 -0
  166. genice3-3.0/genice3/unitcell/Struct12.py +745 -0
  167. genice3-3.0/genice3/unitcell/Struct13.py +745 -0
  168. genice3-3.0/genice3/unitcell/Struct14.py +1090 -0
  169. genice3-3.0/genice3/unitcell/Struct15.py +1429 -0
  170. genice3-3.0/genice3/unitcell/Struct16.py +730 -0
  171. genice3-3.0/genice3/unitcell/Struct17.py +508 -0
  172. genice3-3.0/genice3/unitcell/Struct18.py +373 -0
  173. genice3-3.0/genice3/unitcell/Struct19.py +469 -0
  174. genice3-3.0/genice3/unitcell/Struct20.py +403 -0
  175. genice3-3.0/genice3/unitcell/Struct21.py +817 -0
  176. genice3-3.0/genice3/unitcell/Struct22.py +1021 -0
  177. genice3-3.0/genice3/unitcell/Struct23.py +1021 -0
  178. genice3-3.0/genice3/unitcell/Struct24.py +676 -0
  179. genice3-3.0/genice3/unitcell/Struct25.py +982 -0
  180. genice3-3.0/genice3/unitcell/Struct26.py +712 -0
  181. genice3-3.0/genice3/unitcell/Struct27.py +1036 -0
  182. genice3-3.0/genice3/unitcell/Struct28.py +388 -0
  183. genice3-3.0/genice3/unitcell/Struct29.py +712 -0
  184. genice3-3.0/genice3/unitcell/Struct30.py +505 -0
  185. genice3-3.0/genice3/unitcell/Struct31.py +748 -0
  186. genice3-3.0/genice3/unitcell/Struct32.py +1090 -0
  187. genice3-3.0/genice3/unitcell/Struct33.py +198 -0
  188. genice3-3.0/genice3/unitcell/Struct34.py +541 -0
  189. genice3-3.0/genice3/unitcell/Struct35.py +541 -0
  190. genice3-3.0/genice3/unitcell/Struct36.py +541 -0
  191. genice3-3.0/genice3/unitcell/Struct37.py +577 -0
  192. genice3-3.0/genice3/unitcell/Struct38.py +577 -0
  193. genice3-3.0/genice3/unitcell/Struct39.py +607 -0
  194. genice3-3.0/genice3/unitcell/Struct40.py +613 -0
  195. genice3-3.0/genice3/unitcell/Struct41.py +1225 -0
  196. genice3-3.0/genice3/unitcell/Struct42.py +1225 -0
  197. genice3-3.0/genice3/unitcell/Struct43.py +1225 -0
  198. genice3-3.0/genice3/unitcell/Struct44.py +679 -0
  199. genice3-3.0/genice3/unitcell/Struct45.py +679 -0
  200. genice3-3.0/genice3/unitcell/Struct46.py +709 -0
  201. genice3-3.0/genice3/unitcell/Struct47.py +709 -0
  202. genice3-3.0/genice3/unitcell/Struct48.py +1369 -0
  203. genice3-3.0/genice3/unitcell/Struct49.py +745 -0
  204. genice3-3.0/genice3/unitcell/Struct50.py +745 -0
  205. genice3-3.0/genice3/unitcell/Struct51.py +403 -0
  206. genice3-3.0/genice3/unitcell/Struct52.py +1429 -0
  207. genice3-3.0/genice3/unitcell/Struct53.py +745 -0
  208. genice3-3.0/genice3/unitcell/Struct54.py +184 -0
  209. genice3-3.0/genice3/unitcell/Struct55.py +505 -0
  210. genice3-3.0/genice3/unitcell/Struct56.py +949 -0
  211. genice3-3.0/genice3/unitcell/Struct57.py +541 -0
  212. genice3-3.0/genice3/unitcell/Struct58.py +1021 -0
  213. genice3-3.0/genice3/unitcell/Struct59.py +1021 -0
  214. genice3-3.0/genice3/unitcell/Struct60.py +1021 -0
  215. genice3-3.0/genice3/unitcell/Struct61.py +1225 -0
  216. genice3-3.0/genice3/unitcell/Struct62.py +995 -0
  217. genice3-3.0/genice3/unitcell/Struct63.py +685 -0
  218. genice3-3.0/genice3/unitcell/Struct64.py +709 -0
  219. genice3-3.0/genice3/unitcell/Struct65.py +709 -0
  220. genice3-3.0/genice3/unitcell/Struct66.py +709 -0
  221. genice3-3.0/genice3/unitcell/Struct67.py +1357 -0
  222. genice3-3.0/genice3/unitcell/Struct68.py +267 -0
  223. genice3-3.0/genice3/unitcell/Struct69.py +406 -0
  224. genice3-3.0/genice3/unitcell/Struct70.py +745 -0
  225. genice3-3.0/genice3/unitcell/Struct71.py +743 -0
  226. genice3-3.0/genice3/unitcell/Struct72.py +745 -0
  227. genice3-3.0/genice3/unitcell/Struct73.py +745 -0
  228. genice3-3.0/genice3/unitcell/Struct74.py +745 -0
  229. genice3-3.0/genice3/unitcell/Struct75.py +745 -0
  230. genice3-3.0/genice3/unitcell/Struct76.py +1429 -0
  231. genice3-3.0/genice3/unitcell/Struct77.py +743 -0
  232. genice3-3.0/genice3/unitcell/Struct78.py +1429 -0
  233. genice3-3.0/genice3/unitcell/Struct79.py +1429 -0
  234. genice3-3.0/genice3/unitcell/Struct80.py +745 -0
  235. genice3-3.0/genice3/unitcell/Struct81.py +1090 -0
  236. genice3-3.0/genice3/unitcell/Struct82.py +1021 -0
  237. genice3-3.0/genice3/unitcell/Struct83.py +1021 -0
  238. genice3-3.0/genice3/unitcell/Struct84.py +541 -0
  239. genice3-3.0/genice3/unitcell/T.py +965 -0
  240. genice3-3.0/genice3/unitcell/TS1.py +222 -0
  241. genice3-3.0/genice3/unitcell/UNTESTED/4R.py +820 -0
  242. genice3-3.0/genice3/unitcell/UNTESTED/__ice14.py +91 -0
  243. genice3-3.0/genice3/unitcell/UNTESTED/bilayer.py +333 -0
  244. genice3-3.0/genice3/unitcell/V.py +2 -0
  245. genice3-3.0/genice3/unitcell/VI.py +2 -0
  246. genice3-3.0/genice3/unitcell/VII.py +2 -0
  247. genice3-3.0/genice3/unitcell/VIII.py +2 -0
  248. genice3-3.0/genice3/unitcell/XI.py +2 -0
  249. genice3-3.0/genice3/unitcell/XII.py +2 -0
  250. genice3-3.0/genice3/unitcell/XIII.py +2 -0
  251. genice3-3.0/genice3/unitcell/XIc-a.py +76 -0
  252. genice3-3.0/genice3/unitcell/XVI.py +2 -0
  253. genice3-3.0/genice3/unitcell/XVII.py +2 -0
  254. genice3-3.0/genice3/unitcell/XXI.py +3 -0
  255. genice3-3.0/genice3/unitcell/YKD.py +388 -0
  256. genice3-3.0/genice3/unitcell/Z.py +2 -0
  257. genice3-3.0/genice3/unitcell/__init__.py +322 -0
  258. genice3-3.0/genice3/unitcell/_test/__init__.py +0 -0
  259. genice3-3.0/genice3/unitcell/aeroice.py +7 -0
  260. genice3-3.0/genice3/unitcell/c0te.py +77 -0
  261. genice3-3.0/genice3/unitcell/c1te.py +108 -0
  262. genice3-3.0/genice3/unitcell/c2te.py +90 -0
  263. genice3-3.0/genice3/unitcell/delta.py +2 -0
  264. genice3-3.0/genice3/unitcell/dtc.py +76 -0
  265. genice3-3.0/genice3/unitcell/eleven.py +160 -0
  266. genice3-3.0/genice3/unitcell/engel01.py +5 -0
  267. genice3-3.0/genice3/unitcell/engel03.py +2 -0
  268. genice3-3.0/genice3/unitcell/engel04.py +2 -0
  269. genice3-3.0/genice3/unitcell/engel05.py +2 -0
  270. genice3-3.0/genice3/unitcell/engel17.py +2 -0
  271. genice3-3.0/genice3/unitcell/engel20.py +2 -0
  272. genice3-3.0/genice3/unitcell/engel23.py +5 -0
  273. genice3-3.0/genice3/unitcell/engel24.py +2 -0
  274. genice3-3.0/genice3/unitcell/engel26.py +2 -0
  275. genice3-3.0/genice3/unitcell/engel29.py +2 -0
  276. genice3-3.0/genice3/unitcell/engel30.py +2 -0
  277. genice3-3.0/genice3/unitcell/engel31.py +2 -0
  278. genice3-3.0/genice3/unitcell/engel34.py +2 -0
  279. genice3-3.0/genice3/unitcell/i.py +55 -0
  280. genice3-3.0/genice3/unitcell/ice0.py +52 -0
  281. genice3-3.0/genice3/unitcell/ice11.py +93 -0
  282. genice3-3.0/genice3/unitcell/ice12.py +62 -0
  283. genice3-3.0/genice3/unitcell/ice13.py +86 -0
  284. genice3-3.0/genice3/unitcell/ice14.py +82 -0
  285. genice3-3.0/genice3/unitcell/ice16.py +2 -0
  286. genice3-3.0/genice3/unitcell/ice17.py +50 -0
  287. genice3-3.0/genice3/unitcell/ice1c.py +78 -0
  288. genice3-3.0/genice3/unitcell/ice1h.py +58 -0
  289. genice3-3.0/genice3/unitcell/ice1h_unit.py +56 -0
  290. genice3-3.0/genice3/unitcell/ice1hte.py +90 -0
  291. genice3-3.0/genice3/unitcell/ice2.py +83 -0
  292. genice3-3.0/genice3/unitcell/ice21.py +144 -0
  293. genice3-3.0/genice3/unitcell/ice2d.py +111 -0
  294. genice3-3.0/genice3/unitcell/ice2rect.py +379 -0
  295. genice3-3.0/genice3/unitcell/ice3.py +52 -0
  296. genice3-3.0/genice3/unitcell/ice4.py +172 -0
  297. genice3-3.0/genice3/unitcell/ice5.py +70 -0
  298. genice3-3.0/genice3/unitcell/ice6.py +82 -0
  299. genice3-3.0/genice3/unitcell/ice7.py +100 -0
  300. genice3-3.0/genice3/unitcell/ice8.py +91 -0
  301. genice3-3.0/genice3/unitcell/ice9.py +82 -0
  302. genice3-3.0/genice3/unitcell/iceA.py +67 -0
  303. genice3-3.0/genice3/unitcell/iceB.py +62 -0
  304. genice3-3.0/genice3/unitcell/iceL.py +69 -0
  305. genice3-3.0/genice3/unitcell/iceM.py +74 -0
  306. genice3-3.0/genice3/unitcell/iceMd.py +17 -0
  307. genice3-3.0/genice3/unitcell/iceR.py +78 -0
  308. genice3-3.0/genice3/unitcell/iceT.py +112 -0
  309. genice3-3.0/genice3/unitcell/iceT2.py +199 -0
  310. genice3-3.0/genice3/unitcell/iceXXI.py +3 -0
  311. genice3-3.0/genice3/unitcell/mu.py +2 -0
  312. genice3-3.0/genice3/unitcell/one.py +120 -0
  313. genice3-3.0/genice3/unitcell/oprism.py +148 -0
  314. genice3-3.0/genice3/unitcell/prism.py +237 -0
  315. genice3-3.0/genice3/unitcell/psigma.py +2 -0
  316. genice3-3.0/genice3/unitcell/sH.py +2 -0
  317. genice3-3.0/genice3/unitcell/sI.py +2 -0
  318. genice3-3.0/genice3/unitcell/sII.py +2 -0
  319. genice3-3.0/genice3/unitcell/sIII.py +2 -0
  320. genice3-3.0/genice3/unitcell/sIV.py +2 -0
  321. genice3-3.0/genice3/unitcell/sTprime.py +64 -0
  322. genice3-3.0/genice3/unitcell/sV.py +2 -0
  323. genice3-3.0/genice3/unitcell/sVII.py +2 -0
  324. genice3-3.0/genice3/unitcell/sigma.py +2 -0
  325. genice3-3.0/genice3/unitcell/xFAU.py +236 -0
  326. genice3-3.0/genice3/unitcell/xdtc.py +150 -0
  327. genice3-3.0/genice3/unitcell/zeolite.py +162 -0
  328. genice3-3.0/genice3/unitcell/zra-d.py +2 -0
  329. genice3-3.0/genice3/util.py +660 -0
  330. genice3-3.0/genice3/webapi.py +355 -0
  331. genice3-3.0/genice3.egg-info/PKG-INFO +176 -0
  332. genice3-3.0/genice3.egg-info/SOURCES.txt +677 -0
  333. genice3-3.0/genice3.egg-info/dependency_links.txt +1 -0
  334. genice3-3.0/genice3.egg-info/entry_points.txt +4 -0
  335. genice3-3.0/genice3.egg-info/requires.txt +36 -0
  336. genice3-3.0/genice3.egg-info/top_level.txt +2 -0
  337. genice3-3.0/pyproject.toml +122 -0
  338. genice3-3.0/setup.cfg +4 -0
  339. genice3-3.0/setup.py +42 -0
  340. genice3-3.0/tests/test_cli_ux.py +165 -0
  341. genice3-3.0/tests/test_core.py +123 -0
  342. genice3-3.0/tests/test_dependency_engine.py +88 -0
  343. genice3-3.0/tests/test_doc_commands.py +87 -0
  344. genice3-3.0/tests/test_genice_inputs.py +85 -0
  345. genice3-3.0/tests/test_gromacs_parse_options.py +71 -0
  346. genice3-3.0/tests/test_integration.py +179 -0
  347. genice3-3.0/tests/test_logging_config.py +128 -0
  348. genice3-3.0/tests/test_mcp.py +52 -0
  349. genice3-3.0/tests/test_optionparser_integration.py +191 -0
  350. genice3-3.0/tests/test_service.py +89 -0
  351. genice3-3.0/tests/test_validation.py +260 -0
  352. genice3-3.0/tests/test_webapi.py +161 -0
genice3-3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Masakazu Matsumoto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
genice3-3.0/PKG-INFO ADDED
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.4
2
+ Name: genice3
3
+ Version: 3.0
4
+ Summary: Generate ice-rule-compliant ice and clathrate hydrate structures for molecular simulation. This is the current GenIce.
5
+ Author-email: Masakazu Matsumoto <vitroid@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://genice-dev.github.io/GenIce3
8
+ Project-URL: Documentation, https://genice-dev.github.io/GenIce3
9
+ Project-URL: Source, https://github.com/genice-dev/GenIce3
10
+ Project-URL: Bug Tracker, https://github.com/genice-dev/GenIce3/issues
11
+ Project-URL: Changelog, https://github.com/genice-dev/GenIce3/blob/main/CHANGELOG.md
12
+ Project-URL: manual, https://genice-dev.github.io/GenIce3
13
+ Keywords: GenIce,ice,clathrate hydrate,water,hydrogen disorder,ice rules,molecular simulation,molecular dynamics,crystal structure,structure generator,computational chemistry,GROMACS,LAMMPS
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
23
+ Classifier: Topic :: Scientific/Engineering :: Physics
24
+ Classifier: Topic :: Scientific/Engineering :: Visualization
25
+ Requires-Python: <4.0,>=3.11
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: networkx>=2.0.dev20160901144005
29
+ Requires-Dist: numpy>=2.0
30
+ Requires-Dist: pairlist>=1.0.0
31
+ Requires-Dist: cycless>=0.7
32
+ Requires-Dist: graphstat>=0.3.3
33
+ Requires-Dist: yaplotlib>=0.1.2
34
+ Requires-Dist: openpyscad>=0.5.0
35
+ Requires-Dist: pyyaml>=6.0
36
+ Requires-Dist: jinja2>=3.1.4
37
+ Requires-Dist: cif2ice<0.5.0,>=0.4.1
38
+ Requires-Dist: genice-core<2.0.0,>=1.6.0
39
+ Provides-Extra: web
40
+ Requires-Dist: fastapi<0.136.0,>=0.135.3; extra == "web"
41
+ Requires-Dist: uvicorn[standard]<0.45.0,>=0.44.0; extra == "web"
42
+ Provides-Extra: mcp
43
+ Requires-Dist: mcp<3,>=2.0; extra == "mcp"
44
+ Provides-Extra: dev
45
+ Requires-Dist: httpx>=0.27.0; extra == "dev"
46
+ Requires-Dist: mkdocs>=1.5.0; extra == "dev"
47
+ Requires-Dist: mkdocs-material>=9.0.0; extra == "dev"
48
+ Requires-Dist: pymdown-extensions>=10.0; extra == "dev"
49
+ Requires-Dist: toml>=0.10.2; extra == "dev"
50
+ Requires-Dist: ipykernel>=6.27.1; extra == "dev"
51
+ Requires-Dist: py3dmol>=2.0.4; extra == "dev"
52
+ Requires-Dist: matplotlib>=3.8.2; extra == "dev"
53
+ Requires-Dist: genice2-svg>=2.2; extra == "dev"
54
+ Requires-Dist: plotly>=5.18.0; extra == "dev"
55
+ Requires-Dist: nbformat>=5.9.2; extra == "dev"
56
+ Requires-Dist: genice2-mdanalysis>=0.6.5; extra == "dev"
57
+ Requires-Dist: requests>=2.31.0; extra == "dev"
58
+ Requires-Dist: pytest>=8.1.1; extra == "dev"
59
+ Requires-Dist: genice2-cif>=2.2.1; extra == "dev"
60
+ Requires-Dist: watchdog>=4.0; extra == "dev"
61
+ Dynamic: license-file
62
+
63
+ ![Logo](https://raw.githubusercontent.com/vitroid/GenIce/develop/logo/genice-v0.png)
64
+
65
+ # GenIce3
66
+
67
+ Generate ice-rule-compliant ice and clathrate hydrate structures for molecular simulation. This is the current GenIce.
68
+
69
+ Successor of [GenIce 1](https://github.com/vitroid/GenIce) and [GenIce2](https://github.com/vitroid/GenIce2). Use this package for new work.
70
+
71
+ ```shell
72
+ pip install genice3
73
+ genice3 1h > ice.gro
74
+ ```
75
+
76
+ Python 3.11 or later. Output obeys the ice rules and a chosen net polarization (default zero); it is not energy-minimized. Relax with the intended force field before a production run.
77
+
78
+ **Manual:** [genice-dev.github.io/GenIce3](https://genice-dev.github.io/GenIce3)
79
+ **For AI assistants:** [for-ai-assistants](https://genice-dev.github.io/GenIce3/for-ai-assistants/) · [llms.txt](https://genice-dev.github.io/GenIce3/llms.txt)
80
+ **Agent skill (try it):** [skills.sh/genice-dev/GenIce3](https://skills.sh/genice-dev/GenIce3) · `npx skills add genice-dev/GenIce3`
81
+
82
+ Version 3.0
83
+
84
+ ## New in GenIce3
85
+
86
+ - **Command line**
87
+ - Option syntax is unified; hierarchical options and YAML config files (`-Y` / `--config`) replace many GenIce2-style flags.
88
+ - Polarization control uses `pol_loop_1` and `pol_loop_2` (replacing `depol_loop`).
89
+ - Package and entry points are `genice3` (PyPI: `genice3`); plugin groups use the `genice3.*` namespaces.
90
+ - **API**
91
+ - Python API redesigned around `GenIce3` and `DependencyEngine`: specify what you need and dependent quantities recompute automatically.
92
+ - Embed protonic defects (H₃O⁺, OH⁻) and Bjerrum topological defects from Python (see the [API examples](https://genice-dev.github.io/GenIce3/api-examples/) in the manual).
93
+ - Setter-style configuration and expanded notebooks/examples (`API.ipynb`, `examples/api/`).
94
+ - **Algorithm and core**
95
+ - Ice-rule and depolarization logic delegated to **genice-core** (≥1.6.0); GenIce3 focuses on unit cells, guests, ions, and exporters.
96
+ - Reactive pipeline: `@reactive` properties and explicit dependency tracking replace ad-hoc recalculation.
97
+ - **Unit cells and structures**
98
+ - Lattice plugins moved to `genice3.unitcell`; many GenIce2 structures ported with identity comparison tests.
99
+ - CIF-derived unit cells branch on whether hydrogen positions are supplied; `partial_order` removed.
100
+ - New or updated structures include auxiliary ices, `YKD`, `ice21` (and aliases), and cylindrical **prism** ice (API).
101
+ - **Clathrates, ions, and defects**
102
+ - Cage assessment: GenIce2's `--assess_cages` removed — use exporter `cage_survey` (JSON). Default max cage ring count is 16 (override via exporter options).
103
+ - Spot ions use `-A` / `-C` (spot anion/cation; **not** the old cage-assessment flag). Group guests and spot-cation cage reporting extended; unit-cell ion suboptions (e.g. `--group`) in YAML.
104
+ - **Exporters and visualization**
105
+ - Built-in and plugin exporters (GROMACS, CIF, LAMMPS, yaplot, plotly, py3Dmol, etc.); format functions and option parsing refined.
106
+ - Optional **Web API** (`genice3[web]` / `genice3-web`) and **stdio MCP** (`genice3[mcp]` / `genice3-mcp`); shared `genice3.service` layer.
107
+ - **Documentation and tooling**
108
+ - Manual on GitHub Pages; plugin tables and citations generated from the repo (`make docs`, `make README.md`).
109
+ - For a narrative of the GenIce3 development period and compatibility notes, see [RELEASE_NOTE.md](https://github.com/genice-dev/GenIce3/blob/main/RELEASE_NOTE.md) in the repository.
110
+
111
+ **Example — cage survey (formerly `--assess_cages`):**
112
+
113
+ ```shell
114
+ genice3 CS2 -e cage_survey > cages.json
115
+ ```
116
+
117
+ ## Demo
118
+
119
+ [Try GenIce3 on Google Colaboratory](https://colab.research.google.com/github/genice-dev/GenIce3/blob/main/API.ipynb).
120
+
121
+ Coding agents (Cursor, Claude Code, Codex, …): open [skills.sh/genice-dev/GenIce3](https://skills.sh/genice-dev/GenIce3) or install in one step:
122
+
123
+ ```shell
124
+ npx skills add genice-dev/GenIce3
125
+ ```
126
+
127
+ Optional **MCP** (chat tool calls into GenIce3): `pip install "genice3[mcp]"`, then add `genice3-mcp` to the client’s MCP config. Setup: [MCP](https://genice-dev.github.io/GenIce3/mcp/).
128
+
129
+ ## Requirements
130
+
131
+ - networkx >=2.0.dev20160901144005
132
+ - numpy >=2.0
133
+ - pairlist >=1.0.0
134
+ - cycless >=0.7
135
+ - graphstat >=0.3.3
136
+ - yaplotlib >=0.1.2
137
+ - openpyscad >=0.5.0
138
+ - pyyaml >=6.0
139
+ - jinja2 >=3.1.4
140
+ - cif2ice (>=0.4.1,<0.5.0)
141
+ - genice-core (>=1.6.0,<2.0.0)
142
+
143
+
144
+ ## Installation
145
+
146
+ GenIce3 is on [PyPI](https://pypi.org/project/genice3/). Install with pip:
147
+
148
+ ```shell
149
+ pip install genice3
150
+ ```
151
+
152
+ ## Uninstallation
153
+
154
+ ```shell
155
+ pip uninstall genice3
156
+ ```
157
+
158
+ ## References
159
+
160
+ See the [manual → References](https://genice-dev.github.io/GenIce3/references.html) for the full reference list (generated from `citations.yaml`).
161
+
162
+ ## Citation
163
+
164
+ If you use GenIce in your work, please cite as in [CITATION.cff](CITATION.cff) or:
165
+
166
+ > M. Matsumoto, T. Yagasaki, and H. Tanaka, "GenIce: Hydrogen-Disordered Ice Generator", _J. Comput. Chem._ **39**, 61-64 (2017). [DOI: 10.1002/jcc.25077](http://doi.org/10.1002/jcc.25077)
167
+
168
+ > M. Matsumoto, T. Yagasaki, and H. Tanaka, "GenIce-core: Efficient algorithm for generation of hydrogen-disordered ice structures.", _J. Chem. Phys._ **160**, 094101 (2024). [DOI:10.1063/5.0198056](https://doi.org/10.1063/5.0198056)
169
+
170
+ ## How to contribute
171
+
172
+ GenIce is developed on GitHub (https://github.com/genice-dev/GenIce3). Feedback, bug fixes, and contributions are welcome.
173
+
174
+ ## License
175
+
176
+ MIT License. See [LICENSE](LICENSE) for details.
genice3-3.0/README.md ADDED
@@ -0,0 +1,114 @@
1
+ ![Logo](https://raw.githubusercontent.com/vitroid/GenIce/develop/logo/genice-v0.png)
2
+
3
+ # GenIce3
4
+
5
+ Generate ice-rule-compliant ice and clathrate hydrate structures for molecular simulation. This is the current GenIce.
6
+
7
+ Successor of [GenIce 1](https://github.com/vitroid/GenIce) and [GenIce2](https://github.com/vitroid/GenIce2). Use this package for new work.
8
+
9
+ ```shell
10
+ pip install genice3
11
+ genice3 1h > ice.gro
12
+ ```
13
+
14
+ Python 3.11 or later. Output obeys the ice rules and a chosen net polarization (default zero); it is not energy-minimized. Relax with the intended force field before a production run.
15
+
16
+ **Manual:** [genice-dev.github.io/GenIce3](https://genice-dev.github.io/GenIce3)
17
+ **For AI assistants:** [for-ai-assistants](https://genice-dev.github.io/GenIce3/for-ai-assistants/) · [llms.txt](https://genice-dev.github.io/GenIce3/llms.txt)
18
+ **Agent skill (try it):** [skills.sh/genice-dev/GenIce3](https://skills.sh/genice-dev/GenIce3) · `npx skills add genice-dev/GenIce3`
19
+
20
+ Version 3.0
21
+
22
+ ## New in GenIce3
23
+
24
+ - **Command line**
25
+ - Option syntax is unified; hierarchical options and YAML config files (`-Y` / `--config`) replace many GenIce2-style flags.
26
+ - Polarization control uses `pol_loop_1` and `pol_loop_2` (replacing `depol_loop`).
27
+ - Package and entry points are `genice3` (PyPI: `genice3`); plugin groups use the `genice3.*` namespaces.
28
+ - **API**
29
+ - Python API redesigned around `GenIce3` and `DependencyEngine`: specify what you need and dependent quantities recompute automatically.
30
+ - Embed protonic defects (H₃O⁺, OH⁻) and Bjerrum topological defects from Python (see the [API examples](https://genice-dev.github.io/GenIce3/api-examples/) in the manual).
31
+ - Setter-style configuration and expanded notebooks/examples (`API.ipynb`, `examples/api/`).
32
+ - **Algorithm and core**
33
+ - Ice-rule and depolarization logic delegated to **genice-core** (≥1.6.0); GenIce3 focuses on unit cells, guests, ions, and exporters.
34
+ - Reactive pipeline: `@reactive` properties and explicit dependency tracking replace ad-hoc recalculation.
35
+ - **Unit cells and structures**
36
+ - Lattice plugins moved to `genice3.unitcell`; many GenIce2 structures ported with identity comparison tests.
37
+ - CIF-derived unit cells branch on whether hydrogen positions are supplied; `partial_order` removed.
38
+ - New or updated structures include auxiliary ices, `YKD`, `ice21` (and aliases), and cylindrical **prism** ice (API).
39
+ - **Clathrates, ions, and defects**
40
+ - Cage assessment: GenIce2's `--assess_cages` removed — use exporter `cage_survey` (JSON). Default max cage ring count is 16 (override via exporter options).
41
+ - Spot ions use `-A` / `-C` (spot anion/cation; **not** the old cage-assessment flag). Group guests and spot-cation cage reporting extended; unit-cell ion suboptions (e.g. `--group`) in YAML.
42
+ - **Exporters and visualization**
43
+ - Built-in and plugin exporters (GROMACS, CIF, LAMMPS, yaplot, plotly, py3Dmol, etc.); format functions and option parsing refined.
44
+ - Optional **Web API** (`genice3[web]` / `genice3-web`) and **stdio MCP** (`genice3[mcp]` / `genice3-mcp`); shared `genice3.service` layer.
45
+ - **Documentation and tooling**
46
+ - Manual on GitHub Pages; plugin tables and citations generated from the repo (`make docs`, `make README.md`).
47
+ - For a narrative of the GenIce3 development period and compatibility notes, see [RELEASE_NOTE.md](https://github.com/genice-dev/GenIce3/blob/main/RELEASE_NOTE.md) in the repository.
48
+
49
+ **Example — cage survey (formerly `--assess_cages`):**
50
+
51
+ ```shell
52
+ genice3 CS2 -e cage_survey > cages.json
53
+ ```
54
+
55
+ ## Demo
56
+
57
+ [Try GenIce3 on Google Colaboratory](https://colab.research.google.com/github/genice-dev/GenIce3/blob/main/API.ipynb).
58
+
59
+ Coding agents (Cursor, Claude Code, Codex, …): open [skills.sh/genice-dev/GenIce3](https://skills.sh/genice-dev/GenIce3) or install in one step:
60
+
61
+ ```shell
62
+ npx skills add genice-dev/GenIce3
63
+ ```
64
+
65
+ Optional **MCP** (chat tool calls into GenIce3): `pip install "genice3[mcp]"`, then add `genice3-mcp` to the client’s MCP config. Setup: [MCP](https://genice-dev.github.io/GenIce3/mcp/).
66
+
67
+ ## Requirements
68
+
69
+ - networkx >=2.0.dev20160901144005
70
+ - numpy >=2.0
71
+ - pairlist >=1.0.0
72
+ - cycless >=0.7
73
+ - graphstat >=0.3.3
74
+ - yaplotlib >=0.1.2
75
+ - openpyscad >=0.5.0
76
+ - pyyaml >=6.0
77
+ - jinja2 >=3.1.4
78
+ - cif2ice (>=0.4.1,<0.5.0)
79
+ - genice-core (>=1.6.0,<2.0.0)
80
+
81
+
82
+ ## Installation
83
+
84
+ GenIce3 is on [PyPI](https://pypi.org/project/genice3/). Install with pip:
85
+
86
+ ```shell
87
+ pip install genice3
88
+ ```
89
+
90
+ ## Uninstallation
91
+
92
+ ```shell
93
+ pip uninstall genice3
94
+ ```
95
+
96
+ ## References
97
+
98
+ See the [manual → References](https://genice-dev.github.io/GenIce3/references.html) for the full reference list (generated from `citations.yaml`).
99
+
100
+ ## Citation
101
+
102
+ If you use GenIce in your work, please cite as in [CITATION.cff](CITATION.cff) or:
103
+
104
+ > M. Matsumoto, T. Yagasaki, and H. Tanaka, "GenIce: Hydrogen-Disordered Ice Generator", _J. Comput. Chem._ **39**, 61-64 (2017). [DOI: 10.1002/jcc.25077](http://doi.org/10.1002/jcc.25077)
105
+
106
+ > M. Matsumoto, T. Yagasaki, and H. Tanaka, "GenIce-core: Efficient algorithm for generation of hydrogen-disordered ice structures.", _J. Chem. Phys._ **160**, 094101 (2024). [DOI:10.1063/5.0198056](https://doi.org/10.1063/5.0198056)
107
+
108
+ ## How to contribute
109
+
110
+ GenIce is developed on GitHub (https://github.com/genice-dev/GenIce3). Feedback, bug fixes, and contributions are welcome.
111
+
112
+ ## License
113
+
114
+ MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,218 @@
1
+ """
2
+ Dependency-resolution engine for reactive pipelines.
3
+
4
+ Executes only the tasks needed to reach a given goal, working backwards
5
+ from the target. May be split into a separate package in the future.
6
+ """
7
+
8
+ import inspect
9
+ from logging import getLogger
10
+ import time
11
+
12
+ # @reactive でデコレートされた関数を (モジュール名, 関数) で保持。
13
+ # 利用側が _register_tasks で get_reactive_tasks(__name__) により自モジュール分だけ登録する。
14
+ _REACTIVE_REGISTRY = []
15
+
16
+ # Sentinel: Input に default も default_factory もない。
17
+ _MISSING = object()
18
+
19
+
20
+ class UnsetInputError(Exception):
21
+ """Raised when a required ``Input`` has not been assigned."""
22
+
23
+
24
+ def reactive(func=None, *, public=False):
25
+ """Marker decorator to register a function as a DependencyEngine task.
26
+
27
+ The decorated function name becomes the reactive property name
28
+ (for example, ``genice.cages``). Names should be nouns.
29
+
30
+ Args:
31
+ public: If True, the task is part of the public API listing.
32
+
33
+ Side effect: the function is registered in ``_REACTIVE_REGISTRY``.
34
+ Use ``get_reactive_tasks(module_name)`` to obtain the task list for a module.
35
+ """
36
+
37
+ def decorate(fn):
38
+ fn._reactive_public = public
39
+ _REACTIVE_REGISTRY.append((fn.__module__, fn))
40
+ return fn
41
+
42
+ if func is None:
43
+ return decorate
44
+ return decorate(func)
45
+
46
+
47
+ def get_reactive_tasks(module_name: str):
48
+ """Return functions decorated with ``@reactive`` in the given module."""
49
+ return [f for mod, f in _REACTIVE_REGISTRY if mod == module_name]
50
+
51
+
52
+ class Input:
53
+ """Descriptor for a DAG root (settable reactive input).
54
+
55
+ Assignment stores the value, optionally coerces it (same kind of object),
56
+ runs ``on_set``, and clears ``obj.engine.cache``. Getter and
57
+ ``collect_inputs`` are derived from the class-level declaration.
58
+
59
+ Do not use ``coerce`` to change the public type (for example str to a
60
+ constructed object). Keep a separate factory method for that.
61
+ """
62
+
63
+ def __init__(
64
+ self,
65
+ *,
66
+ default=_MISSING,
67
+ default_factory=None,
68
+ public=False,
69
+ required=False,
70
+ coerce=None,
71
+ on_set=None,
72
+ unset_error=None,
73
+ doc=None,
74
+ ):
75
+ if required and (default is not _MISSING or default_factory is not None):
76
+ raise TypeError("required Input cannot have a default")
77
+ if default is not _MISSING and default_factory is not None:
78
+ raise TypeError("specify default or default_factory, not both")
79
+ self.default = default
80
+ self.default_factory = default_factory
81
+ self.public = public
82
+ self.required = required
83
+ self.coerce = coerce
84
+ self.on_set = on_set
85
+ self.unset_error = unset_error
86
+ self.name = None
87
+ self.private_name = None
88
+ if doc is not None:
89
+ self.__doc__ = doc
90
+
91
+ def __set_name__(self, owner, name):
92
+ self.name = name
93
+ self.private_name = f"_{name}"
94
+ if "_input_fields" not in owner.__dict__:
95
+ owner._input_fields = {}
96
+ owner._input_fields[name] = self
97
+
98
+ def is_set(self, obj) -> bool:
99
+ """Return True if this input has been assigned on ``obj``."""
100
+ return self.private_name in obj.__dict__
101
+
102
+ def __get__(self, obj, objtype=None):
103
+ if obj is None:
104
+ return self
105
+ if self.private_name in obj.__dict__:
106
+ return obj.__dict__[self.private_name]
107
+ if self.required:
108
+ if self.unset_error is not None:
109
+ err = self.unset_error
110
+ raise err() if callable(err) else err
111
+ raise UnsetInputError(
112
+ f"{type(obj).__name__}.{self.name} is not set."
113
+ )
114
+ if self.default_factory is not None:
115
+ return self.default_factory()
116
+ if self.default is not _MISSING:
117
+ return self.default
118
+ raise UnsetInputError(f"{type(obj).__name__}.{self.name} is not set.")
119
+
120
+ def __set__(self, obj, value):
121
+ if self.coerce is not None:
122
+ value = self.coerce(value)
123
+ obj.__dict__[self.private_name] = value
124
+ logger = getattr(obj, "logger", None)
125
+ if logger is not None:
126
+ logger.debug(" %s=%r", self.name, value)
127
+ if self.on_set is not None:
128
+ self.on_set(obj, value)
129
+ engine = getattr(obj, "engine", None)
130
+ if engine is not None:
131
+ engine.cache.clear()
132
+
133
+
134
+ def input_fields(cls) -> dict:
135
+ """Return ``{name: Input}`` declared on ``cls`` (including bases)."""
136
+ fields = {}
137
+ for base in reversed(cls.__mro__):
138
+ fields.update(getattr(base, "_input_fields", {}))
139
+ return fields
140
+
141
+
142
+ def collect_inputs(obj) -> dict:
143
+ """Return a dict of all ``Input`` values on ``obj`` for ``engine.resolve``."""
144
+ return {name: getattr(obj, name) for name in input_fields(type(obj))}
145
+
146
+
147
+ class DependencyEngine:
148
+ """Engine that back-solves dependencies and runs only needed tasks."""
149
+
150
+ logger = getLogger("dependency_engine")
151
+
152
+ def __init__(self):
153
+ self.registry = {} # { 'output_name': function }
154
+ self.cache = {}
155
+
156
+ def task(self, func):
157
+ """Decorator to register a task with ``func.__name__`` as its output name."""
158
+ self.registry[func.__name__] = func
159
+ return func
160
+
161
+ def resolve(self, target: str, inputs: dict):
162
+ """Resolve ``target`` by recursively computing its dependencies."""
163
+
164
+ # 1. 既に計算済み or 入力として与えられているならそれを返す
165
+ if target in inputs:
166
+ return inputs[target]
167
+ if target in self.cache:
168
+ return self.cache[target]
169
+
170
+ # 2. 生成ルール(関数)を探す
171
+ if target not in self.registry:
172
+ raise ValueError(f"Don't know how to make '{target}'")
173
+
174
+ func = self.registry[target]
175
+
176
+ # 3. その関数の引数(依存先)を調べて、再帰的に解決する
177
+ sig = inspect.signature(func)
178
+ dependencies = {}
179
+ for param_name in sig.parameters:
180
+ dependencies[param_name] = self.resolve(param_name, inputs)
181
+
182
+ # 4. 実行して結果を保存(所要時間は JSON ログの duration_ms にも載せる)
183
+ now = time.time()
184
+ result = func(**dependencies)
185
+ delta_ms = (time.time() - now) * 1000.0
186
+ self.logger.info(
187
+ "Executing: %s",
188
+ target,
189
+ extra={
190
+ "event": "task.execute",
191
+ "task": target,
192
+ "duration_ms": round(delta_ms, 3),
193
+ },
194
+ )
195
+ self.cache[target] = result
196
+ return result
197
+
198
+
199
+ def _demo():
200
+ """Package self-test demo (run with ``python -m dependency_engine``)."""
201
+ engine = DependencyEngine()
202
+
203
+ @engine.task
204
+ def reaction_A(raw_material: int):
205
+ return raw_material * 2
206
+
207
+ @engine.task
208
+ def reaction_B(reaction_A: int, catalyst: int):
209
+ return reaction_A + catalyst
210
+
211
+ result = engine.resolve(
212
+ target="reaction_B", inputs={"raw_material": 10, "catalyst": 5}
213
+ )
214
+ print(result)
215
+
216
+
217
+ if __name__ == "__main__":
218
+ _demo()
@@ -0,0 +1,4 @@
1
+ """python -m dependency_engine でデモを実行"""
2
+ from dependency_engine import _demo
3
+
4
+ _demo()
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+ from logging import getLogger
3
+
4
+ from genice3.logging_config import setup_logging as _setup_logging_impl
5
+
6
+
7
+ class ConfigurationError(Exception):
8
+ """設定に関するエラーを表す例外"""
9
+
10
+ pass
11
+
12
+
13
+ def _setup_logging(debug: bool = False, fmt: str | None = None) -> str:
14
+ """ルートロガーの設定を統一する(:func:`genice3.logging_config.setup_logging` への薄いラップ)。"""
15
+ return _setup_logging_impl(debug=debug, fmt=fmt)
16
+
17
+
18
+ # API利用時にも明示的な呼び出しなしでINFOログが出るよう、
19
+ # ハンドラ未設定の場合だけデフォルト設定を適用する。
20
+ # (ユーザーが事前に basicConfig 等を呼んでいる場合はそちらを尊重する)
21
+ if not getLogger().handlers:
22
+ _setup_logging(debug=False)
@@ -0,0 +1,43 @@
1
+ """
2
+ カスタムビルドフック: symlinkを実際のファイルにコピーする
3
+ """
4
+ import os
5
+ import shutil
6
+ from pathlib import Path
7
+ from setuptools.command.build_py import build_py as _build_py
8
+
9
+
10
+ class BuildPy(_build_py):
11
+ """symlinkを実際のファイルにコピーするカスタムビルドコマンド"""
12
+
13
+ def copy_file(self, src, dst, preserve_mode=True, preserve_times=True, link=None, level=1):
14
+ """ファイルをコピーする際に、symlinkの場合は実際のファイルをコピー"""
15
+ # symlinkの場合は、ターゲットファイルをコピー
16
+ if os.path.islink(src):
17
+ # symlinkのターゲットを取得
18
+ target = os.readlink(src)
19
+
20
+ # 相対パスの場合は、srcのディレクトリからの相対パスとして解決
21
+ if not os.path.isabs(target):
22
+ src_dir = os.path.dirname(src)
23
+ target_path = os.path.normpath(os.path.join(src_dir, target))
24
+ else:
25
+ target_path = target
26
+
27
+ # ターゲットファイルが存在する場合のみコピー
28
+ if os.path.exists(target_path):
29
+ # ターゲットファイルをコピー(再帰的に呼び出し)
30
+ return super().copy_file(
31
+ target_path, dst, preserve_mode, preserve_times, link, level
32
+ )
33
+ else:
34
+ # ターゲットが見つからない場合は警告を出してスキップ
35
+ print(f"Warning: symlink target not found: {src} -> {target_path}")
36
+ return dst, False
37
+
38
+ # 通常のファイルの場合は親クラスのメソッドを呼び出す
39
+ return super().copy_file(src, dst, preserve_mode, preserve_times, link, level)
40
+
41
+
42
+
43
+