abmptools 2.19.2__tar.gz → 2.20.1__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 (188) hide show
  1. {abmptools-2.19.2/abmptools.egg-info → abmptools-2.20.1}/PKG-INFO +2 -2
  2. {abmptools-2.19.2 → abmptools-2.20.1}/README.md +1 -1
  3. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/__init__.py +4 -0
  4. abmptools-2.20.1/abmptools/_version.py +40 -0
  5. abmptools-2.20.1/abmptools/amorphous/antechamber_am1bcc.py +110 -0
  6. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/builder.py +3 -1
  7. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/molecule_prep.py +19 -1
  8. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/core/system_model.py +17 -0
  9. abmptools-2.20.1/abmptools/gro2udf/angle_table.py +136 -0
  10. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/cli.py +39 -9
  11. abmptools-2.20.1/abmptools/gro2udf/ff_detect.py +229 -0
  12. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/guard.py +157 -20
  13. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/mdp_parser.py +41 -0
  14. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/top_adapter.py +26 -1
  15. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/top_exporter.py +400 -50
  16. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/top_model.py +38 -0
  17. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/top_parser.py +351 -25
  18. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/trajectory/postprocess.py +3 -1
  19. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/gromacs/writers/top_writer.py +38 -6
  20. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/udf_adapter.py +244 -13
  21. {abmptools-2.19.2 → abmptools-2.20.1/abmptools.egg-info}/PKG-INFO +2 -2
  22. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools.egg-info/SOURCES.txt +11 -1
  23. {abmptools-2.19.2 → abmptools-2.20.1}/pyproject.toml +1 -1
  24. abmptools-2.20.1/tests/test_amorphous_antechamber_am1bcc.py +82 -0
  25. abmptools-2.20.1/tests/test_gro2udf_angle_table.py +539 -0
  26. abmptools-2.20.1/tests/test_gro2udf_coarse_grained.py +162 -0
  27. abmptools-2.20.1/tests/test_gro2udf_ff_auto.py +143 -0
  28. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro2udf_guard.py +36 -22
  29. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_regression.py +6 -1
  30. abmptools-2.20.1/tests/test_top_exporter_pressure_dc.py +44 -0
  31. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_parser.py +86 -0
  32. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_trajectory_gen_for_udf.py +16 -0
  33. abmptools-2.20.1/tests/test_udf2gro_cognac_ff.py +160 -0
  34. abmptools-2.20.1/tests/test_version_attr.py +53 -0
  35. abmptools-2.19.2/tests/test_top_exporter_pressure_dc.py +0 -45
  36. {abmptools-2.19.2 → abmptools-2.20.1}/LICENSE +0 -0
  37. {abmptools-2.19.2 → abmptools-2.20.1}/NOTICE +0 -0
  38. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/abinit_io.py +0 -0
  39. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/addsolvfrag.py +0 -0
  40. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/ajf2config.py +0 -0
  41. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/ajfserial.py +0 -0
  42. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/__init__.py +0 -0
  43. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/__main__.py +0 -0
  44. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/cli.py +0 -0
  45. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/density.py +0 -0
  46. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/mdp_protocol.py +0 -0
  47. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/models.py +0 -0
  48. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/ndx_writer.py +0 -0
  49. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/packing.py +0 -0
  50. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/parameterizer.py +0 -0
  51. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/pubchem.py +0 -0
  52. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/system_model_adapter.py +0 -0
  53. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/amorphous/trajectory_ingest.py +0 -0
  54. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/anlfmo.py +0 -0
  55. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/convertcpf.py +0 -0
  56. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/core/__init__.py +0 -0
  57. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/core/_subprocess.py +0 -0
  58. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/core/acpype.py +0 -0
  59. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/core/top_atomtypes.py +0 -0
  60. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/cpf2ifielist.py +0 -0
  61. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/cpfmanager.py +0 -0
  62. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/generate_difie.py +0 -0
  63. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/generateajf.py +0 -0
  64. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/geomopt/__init__.py +0 -0
  65. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/geomopt/mace_optimizer.py +0 -0
  66. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/geomopt/openff_openmm_minimizer.py +0 -0
  67. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/geomopt/pyscf_optimizer.py +0 -0
  68. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/getcharge.py +0 -0
  69. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/getifiepieda.py +0 -0
  70. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/__init__.py +0 -0
  71. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/__main__.py +0 -0
  72. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/default_template.udf +0 -0
  73. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/default_template_cognac101.udf +0 -0
  74. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/exporter.py +0 -0
  75. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/gro_adapter.py +0 -0
  76. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/gro_parser.py +0 -0
  77. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/make_whole.py +0 -0
  78. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/molecule_select.py +0 -0
  79. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/trajectory_io.py +0 -0
  80. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/gro2udf/udf_writer.py +0 -0
  81. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/log2config.py +0 -0
  82. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/log2cpf.py +0 -0
  83. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/logmanager.py +0 -0
  84. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/mol_io.py +0 -0
  85. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/molcalc.py +0 -0
  86. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/pdb2fmo.py +0 -0
  87. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/pdb_io.py +0 -0
  88. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/pdbmodify.py +0 -0
  89. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/readcif.py +0 -0
  90. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/setfmo.py +0 -0
  91. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/trajectory/__init__.py +0 -0
  92. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/trajectory/__main__.py +0 -0
  93. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/trajectory/cli.py +0 -0
  94. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2fmo.py +0 -0
  95. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/__init__.py +0 -0
  96. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/__main__.py +0 -0
  97. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/cli.py +0 -0
  98. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/exporter.py +0 -0
  99. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/gromacs/__init__.py +0 -0
  100. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/gromacs/writers/__init__.py +0 -0
  101. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/gromacs/writers/_validator.py +0 -0
  102. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/gromacs/writers/gro_writer.py +0 -0
  103. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/gromacs/writers/itp_writer.py +0 -0
  104. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf2gro/gromacs/writers/mdp_writer.py +0 -0
  105. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udf_io.py +0 -0
  106. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udfcharge/__init__.py +0 -0
  107. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udfcharge/__main__.py +0 -0
  108. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udfcharge/core.py +0 -0
  109. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udfcreate.py +0 -0
  110. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udfcreate_v2.py +0 -0
  111. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools/udfrm_io.py +0 -0
  112. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools.egg-info/dependency_links.txt +0 -0
  113. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools.egg-info/entry_points.txt +0 -0
  114. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools.egg-info/requires.txt +0 -0
  115. {abmptools-2.19.2 → abmptools-2.20.1}/abmptools.egg-info/top_level.txt +0 -0
  116. {abmptools-2.19.2 → abmptools-2.20.1}/setup.cfg +0 -0
  117. {abmptools-2.19.2 → abmptools-2.20.1}/setup.py +0 -0
  118. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_abinit_io.py +0 -0
  119. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_ajf_section_headers.py +0 -0
  120. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_amorphous_charges_from_file.py +0 -0
  121. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_amorphous_models.py +0 -0
  122. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_amorphous_molecule_prep.py +0 -0
  123. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_anlfmo.py +0 -0
  124. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_builder_integration.py +0 -0
  125. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_builder_mocked.py +0 -0
  126. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_charge_method.py +0 -0
  127. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_citation_version.py +0 -0
  128. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_cli_scripts.py +0 -0
  129. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_console_output_cp932.py +0 -0
  130. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_cpfmanager.py +0 -0
  131. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_density.py +0 -0
  132. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_enhanced_pieda.py +0 -0
  133. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_getifiepieda.py +0 -0
  134. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro2udf_atom_identity.py +0 -0
  135. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro2udf_constraints_as_bonds.py +0 -0
  136. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro2udf_encoding.py +0 -0
  137. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro2udf_frame_thinning.py +0 -0
  138. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro2udf_keep_molecules.py +0 -0
  139. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro2udf_make_whole.py +0 -0
  140. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro2udf_nose_hoover.py +0 -0
  141. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro2udf_potential_names.py +0 -0
  142. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro2udf_torsion_scaling.py +0 -0
  143. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro2udf_type_name_collision.py +0 -0
  144. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro_adapter.py +0 -0
  145. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro_parser.py +0 -0
  146. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_gro_writer.py +0 -0
  147. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_ifie_methods.py +0 -0
  148. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_interchange_adapter.py +0 -0
  149. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_logmanager.py +0 -0
  150. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_md_fmo_resume.py +0 -0
  151. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_mdp_parser.py +0 -0
  152. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_mdp_protocol.py +0 -0
  153. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_mdp_writer.py +0 -0
  154. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_mol_io.py +0 -0
  155. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_molcalc.py +0 -0
  156. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_ndx_writer.py +0 -0
  157. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_parameterizer.py +0 -0
  158. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_pdb_io.py +0 -0
  159. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_pubchem.py +0 -0
  160. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_pyscf_optimizer.py +0 -0
  161. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_pyscf_parsers.py +0 -0
  162. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_read_ifie_hf_fallback.py +0 -0
  163. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_readcif.py +0 -0
  164. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_setfmo.py +0 -0
  165. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_system_model.py +0 -0
  166. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_system_model_extensions.py +0 -0
  167. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_adapter_torsion_index.py +0 -0
  168. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_atomtypes_element.py +0 -0
  169. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_exporter_deformation_none.py +0 -0
  170. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_exporter_display_type.py +0 -0
  171. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_exporter_energy_alignment.py +0 -0
  172. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_exporter_frames_override.py +0 -0
  173. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_exporter_static_cell.py +0 -0
  174. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_exporter_static_structure.py +0 -0
  175. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_fold_atomtypes.py +0 -0
  176. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_model.py +0 -0
  177. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_top_writer.py +0 -0
  178. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_trajectory_ingest.py +0 -0
  179. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_trajectory_postprocess.py +0 -0
  180. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_udf2gro_molname_helpers.py +0 -0
  181. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_udf2gro_multiterm_dihedrals.py +0 -0
  182. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_udf2gro_thermostat_barostat.py +0 -0
  183. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_udf2gro_unit_parameter.py +0 -0
  184. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_udf_io.py +0 -0
  185. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_udfcreate.py +0 -0
  186. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_udfcreate_v2.py +0 -0
  187. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_udfcreate_v2_byte_equivalence.py +0 -0
  188. {abmptools-2.19.2 → abmptools-2.20.1}/tests/test_udfrm_io.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: abmptools
3
- Version: 2.19.2
3
+ Version: 2.20.1
4
4
  Summary: Pre/post-processing and analysis toolkit for ABINIT-MP Fragment Molecular Orbital calculations
5
5
  Author: Koji Okuwaki
6
6
  License-Expression: Apache-2.0
@@ -86,7 +86,7 @@ A Python toolkit for pre-processing, post-processing, and analysis of Fragment M
86
86
  ### GROMACS ↔ OCTA COGNAC Conversion
87
87
 
88
88
  - **udf2gro**: Convert OCTA UDF files to GROMACS format (`.gro`, `.top`, `.mdp`, `.itp`)
89
- - **gro2udf**: Convert GROMACS files to OCTA UDF format (supports `--from-top` mode)
89
+ - **gro2udf**: Convert GROMACS files to OCTA UDF format (supports `--from-top` mode; `--for-viewing` writes a file meant to be looked at rather than run, leaving out the terms the engine cannot hold and saying which)
90
90
  - **udfcharge**: Transfer per-atom partial charges from a single-molecule UDF to bulk molecules (`transfer`), or restore a neutralized UDF's charges to a target integer formal charge (`restore`)
91
91
 
92
92
  ### Geometry Optimization (`geomopt`)
@@ -36,7 +36,7 @@ A Python toolkit for pre-processing, post-processing, and analysis of Fragment M
36
36
  ### GROMACS ↔ OCTA COGNAC Conversion
37
37
 
38
38
  - **udf2gro**: Convert OCTA UDF files to GROMACS format (`.gro`, `.top`, `.mdp`, `.itp`)
39
- - **gro2udf**: Convert GROMACS files to OCTA UDF format (supports `--from-top` mode)
39
+ - **gro2udf**: Convert GROMACS files to OCTA UDF format (supports `--from-top` mode; `--for-viewing` writes a file meant to be looked at rather than run, leaving out the terms the engine cannot hold and saying which)
40
40
  - **udfcharge**: Transfer per-atom partial charges from a single-molecule UDF to bulk molecules (`transfer`), or restore a neutralized UDF's charges to a target integer formal charge (`restore`)
41
41
 
42
42
  ### Geometry Optimization (`geomopt`)
@@ -1,3 +1,7 @@
1
+ from ._version import get_version as _get_version
2
+
3
+ __version__ = _get_version()
4
+
1
5
  from .pdb_io import pdb_io
2
6
  from .abinit_io import abinit_io
3
7
  from .setfmo import setfmo
@@ -0,0 +1,40 @@
1
+ # -*- coding: utf-8 -*-
2
+ """``abmptools.__version__``.
3
+
4
+ The version is declared once, in ``pyproject.toml``; an installed wheel carries
5
+ it in its metadata, so that is where it is read from. A source checkout is the
6
+ exception: an editable install keeps the metadata written when it was
7
+ installed, and after a version bump ``importlib.metadata`` goes on reporting
8
+ the old number (seen: 2.9.0 from a 2.19 tree). When the package is imported
9
+ from a tree that has its ``pyproject.toml`` next to it, that file is read
10
+ instead.
11
+ """
12
+ from __future__ import annotations
13
+
14
+ import pathlib
15
+ import re
16
+ from importlib import metadata
17
+
18
+ UNKNOWN = "0+unknown"
19
+
20
+
21
+ def _from_source_tree(pkg_dir: pathlib.Path):
22
+ pyproject = pkg_dir.parent / "pyproject.toml"
23
+ try:
24
+ text = pyproject.read_text(encoding="utf-8")
25
+ except OSError:
26
+ return None
27
+ if not re.search(r'^name = "abmptools"', text, re.M):
28
+ return None
29
+ m = re.search(r'^version = "([^"]+)"', text, re.M)
30
+ return m.group(1) if m else None
31
+
32
+
33
+ def get_version(pkg_dir: pathlib.Path = pathlib.Path(__file__).resolve().parent) -> str:
34
+ v = _from_source_tree(pkg_dir)
35
+ if v:
36
+ return v
37
+ try:
38
+ return metadata.version("abmptools")
39
+ except metadata.PackageNotFoundError:
40
+ return UNKNOWN
@@ -0,0 +1,110 @@
1
+ # -*- coding: utf-8 -*-
2
+ """AM1-BCC charges through antechamber on Windows, where OpenFF cannot start it.
3
+
4
+ OpenFF's ``AmberToolsToolkitWrapper.assign_partial_charges`` runs
5
+ ``subprocess.check_output(["antechamber", ...])`` with ``-pf yes``. Two things stop
6
+ that on Windows with the native Windows build of AmberTools:
7
+
8
+ - that build keeps the program as ``bin\\wrapped_progs\\antechamber.exe`` behind
9
+ ``bin\\antechamber.bat``; Windows starts a bare ``antechamber`` only as an ``.exe``
10
+ on PATH, so the ``.bat`` is never reached and the call fails;
11
+ - ``-pf yes`` makes antechamber remove its scratch files by running ``rm -f`` through
12
+ the shell, and Windows has no ``rm``: antechamber stops ("Cannot properly run rm -f").
13
+
14
+ :func:`assign_am1bcc` does what that method does (one RDKit conformer with the same
15
+ RMS cutoff, the same two antechamber commands, the charges read back in atom order,
16
+ normalised to the formal charge) with the ``.exe`` started directly, ``AMBERHOME`` set
17
+ and ``bin`` on PATH (where the build keeps its DLLs and ``sqm``), and ``-pf n``. The
18
+ molecule then carries its charges and Interchange is told to keep them
19
+ (``charge_from_molecules``), as for ``charge_method='nagl'`` / ``'gasteiger'``.
20
+ Linux and macOS keep OpenFF's own path.
21
+ """
22
+ from __future__ import annotations
23
+
24
+ import os
25
+ import shutil
26
+ import subprocess
27
+ import sys
28
+ import tempfile
29
+ from pathlib import Path
30
+ from typing import Any, Dict, List, Optional, Tuple
31
+
32
+
33
+ def needed() -> bool:
34
+ """Whether AM1-BCC must go through :func:`assign_am1bcc` here (Windows)."""
35
+ return sys.platform == "win32"
36
+
37
+
38
+ def antechamber_command() -> Optional[Tuple[List[str], Dict[str, str]]]:
39
+ """``([antechamber.exe], env)`` for AmberTools' real antechamber, or ``None``.
40
+
41
+ ``AMBERHOME``'s ``bin\\wrapped_progs\\antechamber.exe`` first, then the one beside an
42
+ ``antechamber.bat`` found on PATH, then an ``antechamber(.exe)`` on PATH as it is.
43
+ """
44
+ roots: List[Path] = []
45
+ if os.environ.get("AMBERHOME"):
46
+ roots.append(Path(os.environ["AMBERHOME"]))
47
+ found = shutil.which("antechamber")
48
+ if found and Path(found).suffix.lower() in (".bat", ".cmd"):
49
+ roots.append(Path(found).resolve().parent.parent)
50
+ for root in roots:
51
+ for name in ("antechamber.exe", "antechamber"):
52
+ exe = root / "bin" / "wrapped_progs" / name
53
+ if exe.is_file():
54
+ env = dict(os.environ)
55
+ env["AMBERHOME"] = str(root)
56
+ env["PATH"] = str(root / "bin") + os.pathsep + env.get("PATH", "")
57
+ return [str(exe)], env
58
+ if found and Path(found).suffix.lower() not in (".bat", ".cmd"):
59
+ return [found], dict(os.environ)
60
+ return None
61
+
62
+
63
+ def _run(argv: List[str], cwd: str, env: Dict[str, str]) -> None:
64
+ r = subprocess.run(argv, cwd=cwd, env=env, capture_output=True, text=True)
65
+ if r.returncode != 0:
66
+ tail = "\n".join(((r.stdout or "") + (r.stderr or "")).strip().splitlines()[-8:])
67
+ raise RuntimeError("antechamber failed (exit %d): %s\n%s"
68
+ % (r.returncode, " ".join(argv), tail))
69
+
70
+
71
+ def assign_am1bcc(mol: Any) -> None:
72
+ """Set AM1-BCC partial charges on the OpenFF Molecule *mol* with antechamber / sqm."""
73
+ import numpy as np
74
+ from openff.toolkit.topology import Molecule
75
+ from openff.toolkit.utils.rdkit_wrapper import RDKitToolkitWrapper
76
+ from openff.units import unit
77
+
78
+ cmd = antechamber_command()
79
+ if cmd is None:
80
+ raise RuntimeError(
81
+ "AM1-BCC charges need AmberTools' antechamber, which was not found "
82
+ "(AMBERHOME, or antechamber on PATH). Install AmberTools, or use "
83
+ "charge_method='nagl' / 'gasteiger'.")
84
+ antechamber, env = cmd
85
+
86
+ rdkit = RDKitToolkitWrapper()
87
+ mol_copy = Molecule(mol)
88
+ # as AmberToolsToolkitWrapper does for am1bcc (rec_confs = 1)
89
+ mol_copy.generate_conformers(n_conformers=1, rms_cutoff=0.25 * unit.angstrom,
90
+ toolkit_registry=rdkit)
91
+ net_charge = mol_copy.total_charge.m_as(unit.elementary_charge)
92
+ with tempfile.TemporaryDirectory(prefix="abmptools_am1bcc_") as tmpdir:
93
+ rdkit.to_file(mol_copy, os.path.join(tmpdir, "molecule.sdf"), file_format="sdf")
94
+ _run(antechamber + ["-i", "molecule.sdf", "-fi", "sdf", "-o", "charged.mol2",
95
+ "-fo", "mol2", "-pf", "n", "-dr", "n", "-c", "bcc",
96
+ "-nc", str(net_charge)], tmpdir, env)
97
+ _run(antechamber + ["-dr", "n", "-i", "charged.mol2", "-fi", "mol2",
98
+ "-o", "charges2.mol2", "-fo", "mol2", "-c", "wc",
99
+ "-cf", "charges.txt", "-pf", "n"], tmpdir, env)
100
+ path = os.path.join(tmpdir, "charges.txt")
101
+ if not os.path.exists(path):
102
+ raise RuntimeError("antechamber / sqm wrote no charges for %s" % mol.to_smiles())
103
+ with open(path, encoding="ascii") as fh:
104
+ tokens = fh.read().split()
105
+ if len(tokens) != mol.n_atoms:
106
+ raise RuntimeError("antechamber returned %d charges for %d atoms (%s)"
107
+ % (len(tokens), mol.n_atoms, mol.to_smiles()))
108
+ charges = np.array([float(t) for t in tokens], dtype=np.float64)
109
+ mol.partial_charges = unit.Quantity(charges, unit.elementary_charge)
110
+ mol._normalize_partial_charges()
@@ -19,6 +19,7 @@ from ..core.system_model import AnnealProtocol
19
19
  from .models import BuildConfig, ComponentSpec
20
20
  from .density import estimate_box_size_nm, weight_fractions_to_counts
21
21
  from .molecule_prep import (
22
+ charges_preassigned,
22
23
  prepare_molecule,
23
24
  get_molecular_weight,
24
25
  write_single_mol_pdb,
@@ -243,7 +244,8 @@ class AmorphousBuilder:
243
244
  # invoking AM1-BCC via sqm (which has no Windows build).
244
245
  # A component with charges of its own is precomputed by definition;
245
246
  # Interchange must be told to keep them rather than re-deriving.
246
- use_precomputed = (self.config.charge_method in ("nagl", "gasteiger")
247
+ # AM1-BCC on Windows is pre-assigned too (charges_preassigned).
248
+ use_precomputed = (charges_preassigned(self.config.charge_method)
247
249
  or any(c.charges_path for c in self.config.components))
248
250
  interchange = create_interchange(
249
251
  molecules=self._molecules,
@@ -282,11 +282,18 @@ def _maybe_assign_partial_charges(mol: Any, method: str, nagl_model: str) -> Non
282
282
 
283
283
  AM1-BCC is handled downstream by Interchange itself (when we pass the
284
284
  topology without `charge_from_molecules`), so we deliberately skip it
285
- here. Anything else is assigned up-front on the Molecule object; the
285
+ here -- except on Windows, where :mod:`.antechamber_am1bcc` assigns it
286
+ (see :func:`charges_preassigned`). Anything else is assigned up-front on the Molecule object; the
286
287
  caller (Interchange) must then be told to use those charges via
287
288
  ``charge_from_molecules=[...]``.
288
289
  """
289
290
  if not method or method == "am1bcc":
291
+ # Windows: OpenFF cannot start AmberTools' antechamber there
292
+ # (antechamber.bat; ``-pf yes`` runs ``rm``), so assign AM1-BCC here
293
+ # with the real antechamber.exe and keep the charges.
294
+ from . import antechamber_am1bcc
295
+ if antechamber_am1bcc.needed():
296
+ antechamber_am1bcc.assign_am1bcc(mol)
290
297
  return
291
298
  if method == "nagl":
292
299
  # NAGLToolkitWrapper は global toolkit registry に自動登録されないため
@@ -315,6 +322,17 @@ def _maybe_assign_partial_charges(mol: Any, method: str, nagl_model: str) -> Non
315
322
  )
316
323
 
317
324
 
325
+ def charges_preassigned(method: str) -> bool:
326
+ """Whether :func:`prepare_molecule` put the charges on the molecule for *method*,
327
+ so that Interchange must keep them (``use_precomputed_charges``)."""
328
+ if method in ("nagl", "gasteiger"):
329
+ return True
330
+ if not method or method == "am1bcc":
331
+ from . import antechamber_am1bcc
332
+ return antechamber_am1bcc.needed()
333
+ return False
334
+
335
+
318
336
  def _molecular_weight(mol: Any) -> float:
319
337
  """Compute molecular weight [g/mol] from an OpenFF Molecule."""
320
338
  from openff.units import unit as off_unit
@@ -82,6 +82,10 @@ class AtomRecord:
82
82
  type_name: str # force-field atom type (e.g. "ca")
83
83
  gro_name: str # name in gro/top atom column (first2 chars + hex index)
84
84
  charge: float # [e]
85
+ #: Residue of the atom, when the source has residues (a protein). None
86
+ #: keeps the old [ atoms ] columns: residue 1, named after the molecule.
87
+ resnr: Optional[int] = None
88
+ resname: Optional[str] = None
85
89
 
86
90
 
87
91
  @dataclass
@@ -143,6 +147,10 @@ class MoleculeTopology:
143
147
  pairs: List[PairRecord] = field(default_factory=list)
144
148
  angles: List[AngleRecord] = field(default_factory=list)
145
149
  dihedrals: List[DihedralRecord] = field(default_factory=list)
150
+ #: Rigid 3-site water: ``(d_OH, d_HH)`` [nm] for [ settles ]. The first
151
+ #: atom must be the oxygen. The writer then also excludes the three
152
+ #: atoms from each other ([ exclusions ]).
153
+ settles: Optional[Tuple[float, float]] = None
146
154
 
147
155
 
148
156
  # ---------------------------------------------------------------------------
@@ -415,3 +423,12 @@ class SystemModel:
415
423
  # The writer layer checks this; adapters set it via
416
424
  # :func:`classify_ensemble` when building the SystemModel.
417
425
  ensemble_family: str = "gromacs_ok"
426
+
427
+ # --- non-bonded rows beyond the combination rule ----------------------
428
+ #: ``(type1, type2, sigma [nm], epsilon [kJ/mol])`` for a pair the
429
+ #: combination rule does not reproduce ([ nonbond_params ]).
430
+ nonbond_params: List[Tuple[str, str, float, float]] = field(default_factory=list)
431
+ #: ``(type1, type2, sigma [nm], epsilon [kJ/mol])`` for a 1-4 pair whose
432
+ #: scale differs from ``fudgeLJ``; epsilon is already scaled
433
+ #: ([ pairtypes ]).
434
+ pair_types: List[Tuple[str, str, float, float]] = field(default_factory=list)
@@ -0,0 +1,136 @@
1
+ # -*- coding: utf-8 -*-
2
+ """Write an angle potential that has no closed form as a numerical table.
3
+
4
+ Restricted bending (GROMACS angle funct 10) is
5
+
6
+ V(t) = k/2 (cos t - cos t0)^2 / sin^2 t
7
+
8
+ and the engine has no such function. It does take a **table**, read as a
9
+ function of one variable, and that reproduces the potential to whatever
10
+ accuracy the mesh is given -- this is not an approximation of the form, only
11
+ of the sampling, and the sampling error is measured in the tests.
12
+
13
+ Two conventions matter and both are read off the engine's own source
14
+ (``src/tableangle.cpp``):
15
+
16
+ * the table variable is ``cos`` of the **exterior** angle,
17
+ ``var = dr0 . dr1 / |dr0||dr1|``, which is ``-cos t`` of the interior angle
18
+ GROMACS uses -- the same supplement that bonded angles already follow;
19
+ * the values are energies in the file's own energy unit.
20
+
21
+ The table file is a small UDF of its own (``Mesh`` + ``FieldValue`` +
22
+ ``Unit_Parameter``), the layout the engine ships as
23
+ ``sample/tablepotential/angle_table.udf``.
24
+ """
25
+ from __future__ import annotations
26
+
27
+ import logging
28
+ import math
29
+ from pathlib import Path
30
+ from typing import List, Optional, Sequence
31
+
32
+ logger = logging.getLogger(__name__)
33
+
34
+ __all__ = ["RESTRICTED_BENDING", "reb_energy", "table_values", "write_angle_table"]
35
+
36
+ #: GROMACS angle funct for restricted bending.
37
+ RESTRICTED_BENDING = 10
38
+
39
+ #: Divisions of the ``cos`` axis. 2000 puts the points 0.001 apart, which
40
+ #: keeps the interpolation error below a thousandth of a kJ/mol away from
41
+ #: the ends (``tests/test_gro2udf_angle_table.py`` measures it).
42
+ DEFAULT_DIVISIONS = 2000
43
+
44
+ #: The potential diverges where ``sin t`` reaches zero, so the two end points
45
+ #: are written at this value instead of infinity. It is far above anything a
46
+ #: simulation reaches, and the engine never needs a force there because the
47
+ #: geometry cannot get past it.
48
+ END_VALUE_KJ = 1.0e6
49
+
50
+
51
+ def reb_energy(var: float, k: float, theta0_deg: float) -> float:
52
+ """Restricted bending at ``var = cos(exterior angle)`` [kJ/mol].
53
+
54
+ *k* is the force constant from the topology [kJ/mol] and *theta0_deg* the
55
+ equilibrium angle in GROMACS' (interior) convention.
56
+ """
57
+ sin2 = 1.0 - var * var
58
+ if sin2 <= 1.0e-12:
59
+ return END_VALUE_KJ
60
+ cos_t = -var # interior angle
61
+ cos_t0 = math.cos(math.radians(theta0_deg))
62
+ value = 0.5 * k * (cos_t - cos_t0) ** 2 / sin2
63
+ return min(value, END_VALUE_KJ)
64
+
65
+
66
+ def table_values(k: float, theta0_deg: float,
67
+ divisions: int = DEFAULT_DIVISIONS) -> List[float]:
68
+ """The ``divisions + 1`` energies [kJ/mol] over ``var`` from -1 to 1."""
69
+ step = 2.0 / divisions
70
+ return [reb_energy(-1.0 + i * step, k, theta0_deg)
71
+ for i in range(divisions + 1)]
72
+
73
+
74
+ def write_angle_table(path: Path, name: str, k: float, theta0_deg: float,
75
+ energy_unit_kj: float = 4.184,
76
+ mass_unit_amu: float = 1.0,
77
+ length_unit_nm: float = 0.1,
78
+ divisions: int = DEFAULT_DIVISIONS) -> Path:
79
+ """Write one table UDF and return its path.
80
+
81
+ *energy_unit_kj* must be the same unit the main UDF uses, because the
82
+ values are written in it.
83
+ """
84
+ path = Path(path)
85
+ values = table_values(k, theta0_deg, divisions)
86
+ rows = "\n".join(" {:.8g}".format(v / energy_unit_kj) for v in values)
87
+ head = [
88
+ "Table Potential FOR COGNAC",
89
+ '\\include{"cognac_unit.udf"}',
90
+ "\\begin{def}",
91
+ "class MeshAxis:{",
92
+ '\tvalues[]:double\t"Parameter of axis. [0]:min, [1]:max, [2]:divisions"',
93
+ "}",
94
+ "Mesh:{",
95
+ '\tname:KEY\t"Name of mesh"',
96
+ '\ttype:string\t"Type of mesh. Always \'Regular\' in COGNAC"',
97
+ '\taxes[]:MeshAxis\t"Array of the parameter for each axis"',
98
+ "}",
99
+ "FieldValue: {",
100
+ ' values[]:double\t[epsilon]\t"Field data"',
101
+ "}",
102
+ "Unit_Parameter:{",
103
+ '\tName: string\t"Name"',
104
+ '\tComment:string\t"Comment"',
105
+ '\tMass:double\t[amu]\t"Unit mass (atomic mass unit)"',
106
+ '\tEnergy:double\t[kJ/mol]\t"Unit energy(kJ/mol)"',
107
+ '\tLength:double\t[nm]\t"Unit length(nm)"',
108
+ '} "Parameters for unit conversion"',
109
+ "\\end{def}",
110
+ "",
111
+ "\\begin{data}",
112
+ "",
113
+ "Mesh:{",
114
+ '\tname "{}"'.format(name),
115
+ '\ttype "REGULAR"',
116
+ "\t[ devision",
117
+ "\t{{ [ -1.0 1.0 {} ] }}".format(divisions),
118
+ "\t]",
119
+ "}",
120
+ "",
121
+ "FieldValue:{",
122
+ "\t[ value",
123
+ rows,
124
+ "\t]",
125
+ "}",
126
+ "",
127
+ 'Unit_Parameter:{{"{}" "restricted bending, written by gro2udf" '
128
+ "{:g} {:g} {:g} }}".format(name, mass_unit_amu, energy_unit_kj,
129
+ length_unit_nm),
130
+ "\\end{data}",
131
+ "",
132
+ ]
133
+ path.write_text("\n".join(head), encoding="utf-8", newline="\n")
134
+ logger.info("angle table written: %s (%d points, k = %g, theta0 = %g)",
135
+ path, divisions + 1, k, theta0_deg)
136
+ return path
@@ -74,15 +74,18 @@ def _from_top_parser():
74
74
  "and reproduces its output exactly. The "
75
75
  "difference in Q is 0.03%% at 3050 atoms and "
76
76
  "0.6%% at 80.")
77
- parser.add_argument("--ff", dest="force_field", default="gaff",
77
+ parser.add_argument("--ff", dest="force_field", default="auto",
78
78
  help="Force field to declare in Unit_Parameter.Comment "
79
- "as FF=n, where downstream converters read it. A .top "
80
- "does not say which force field it came from, so "
81
- "it has to be named here. Accepts gaff (default), "
82
- "gaff2, amber, amber20, dreiding, uff, oplsaa, "
83
- "loplsaa, loplsaa2023, pcff, a bare number, or "
84
- "'' to leave it unset. An existing value in the "
85
- "template is kept.")
79
+ "as FF=n, where downstream converters read it. "
80
+ "auto (default) names it from the topology: its "
81
+ "#include names, its atom types (GAFF and GAFF2 told "
82
+ "apart by their Lennard-Jones values) and [ defaults ]; "
83
+ "when no single force field fits (two of them, or no "
84
+ "evidence) nothing is written and the reason is "
85
+ "printed. Or name it: gaff, gaff2, amber, amber20, "
86
+ "dreiding, uff, oplsaa, loplsaa, loplsaa2023, pcff, "
87
+ "a bare number, or '' to leave it unset. An existing "
88
+ "value in the template is kept.")
86
89
  parser.add_argument("--template", dest="template_path", default=None,
87
90
  help="Existing COGNAC UDF file (schema template). "
88
91
  "Defaults to the built-in template; a .udf next to the "
@@ -233,6 +236,19 @@ def _from_top_parser():
233
236
  "originals: the [ molecules ] order picks the "
234
237
  "atoms of every frame. A name that is not in "
235
238
  "[ molecules ] is an error.")
239
+ parser.add_argument("--for-viewing", dest="for_viewing",
240
+ action="store_true",
241
+ help="Write a file to be LOOKED AT, not run. Terms "
242
+ "the engine cannot hold (a dihedral whose phase "
243
+ "is neither 0 nor 180, for one) are left out "
244
+ "instead of failing the conversion, never "
245
+ "rewritten into a different one, and each "
246
+ "virtual site becomes a particle tied to its "
247
+ "first host. What the file does not reproduce is "
248
+ "warned about and written to <out>.notes.txt "
249
+ "beside it. The structure, the molecules and the "
250
+ "trajectory are complete; the force field is "
251
+ "not.")
236
252
  parser.add_argument("--allow-unsupported", dest="allow_unsupported",
237
253
  action="store_true",
238
254
  help="Convert even when the .top contains terms "
@@ -402,7 +418,7 @@ def _run_from_top(argv: list) -> None:
402
418
  print("Energy dumped: {}".format(energy_path))
403
419
 
404
420
  from .top_exporter import TopExporter
405
- TopExporter().export(top_path, gro_path, template_path, out_path,
421
+ decision = TopExporter().export(top_path, gro_path, template_path, out_path,
406
422
  mdp_path=args.mdp_path,
407
423
  cognac_version=args.cognac_version,
408
424
  topology_only=args.topology_only,
@@ -412,12 +428,14 @@ def _run_from_top(argv: list) -> None:
412
428
  max_frames=args.max_frames,
413
429
  frame_step=args.frame_step,
414
430
  allow_unsupported=args.allow_unsupported,
431
+ for_viewing=args.for_viewing,
415
432
  constraints_as_bonds=constraints_k,
416
433
  keep_molecules=keep_molecules,
417
434
  make_whole=args.make_whole,
418
435
  force_field=args.force_field,
419
436
  nh_dof=args.nh_dof)
420
437
  print("Written: {}".format(out_path))
438
+ print(_force_field_line(decision, args.force_field))
421
439
  if args.topology_only:
422
440
  if args.initial_gro_path:
423
441
  print(f" (topology + 1 initial frame from {args.initial_gro_path!s}. "
@@ -454,6 +472,18 @@ def _usage(argv) -> None:
454
472
  print(_from_top_parser().format_help())
455
473
 
456
474
 
475
+ def _force_field_line(decision, requested) -> str:
476
+ """One line on what went into Unit_Parameter.Comment, for the log a GUI shows."""
477
+ from .udf_writer import ff_comment
478
+ if decision is None:
479
+ return "Force field: (not decided)"
480
+ if decision.name:
481
+ how = "decided from the topology" if str(requested).strip().lower() == "auto" else "as given"
482
+ return "Force field: {} ({}), {}".format(decision.name, ff_comment(decision.name), how)
483
+ return ("Force field: not written ({}). Name it with --ff <name>."
484
+ .format("; ".join(decision.reasons) or "left unset"))
485
+
486
+
457
487
  def main(argv=None):
458
488
  """gro2udfのコマンドラインエントリポイント。
459
489