Skip to content

Commit

Permalink
Merge pull request #50 from TREX-CoE/basis_r_power
Browse files Browse the repository at this point in the history
Fix PySCF->QP2 transformation
  • Loading branch information
q-posev authored Nov 25, 2024
2 parents 6ed4457 + 8602585 commit b1f4240
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/trexio_tools/converters/convert_from.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ def run_resultsFile(trexio_file, filename, motype=None):
trexio.write_metadata_code_num(trexio_file, 1)
trexio.write_metadata_code(trexio_file,
[str(res).split('.')[-1].split()[0].replace("File","")] )
trexio.write_metadata_author_num(trexio_file, 1)
trexio.write_metadata_author(trexio_file, [res.author])
trexio.write_metadata_description(trexio_file, res.title)
if res.author is not None:
trexio.write_metadata_author_num(trexio_file, 1)
trexio.write_metadata_author(trexio_file, [res.author])
if res.title is not None:
trexio.write_metadata_description(trexio_file, res.title)

# Electrons
# ---------
Expand Down
14 changes: 9 additions & 5 deletions src/trexio_tools/converters/convert_to.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,12 @@ def run_cart_phe(inp, filename, to_cartesian):

ao_num_in = trexio.read_ao_num(inp)

normalization = np.array( [ 1. ] * ao_num_in )
if trexio.has_ao_normalization(inp):
normalization = trexio.read_ao_normalization(inp)

for i,f in enumerate(normalization):
cart_normalization[i] *= f

if to_cartesian == 0:
print("Transformation from cartesian to spherical is not implemented")
Expand Down Expand Up @@ -462,10 +468,6 @@ def run_cart_phe(inp, filename, to_cartesian):
trexio.write_ao_num(out, ao_num_out)
trexio.write_ao_shell(out, shell)

normalization = np.array( [ 1. ] * ao_num_in )
if trexio.has_ao_normalization(inp):
normalization = trexio.read_ao_normalization(inp)

trexio.write_ao_normalization(out, cart_normalization)

"""
Expand Down Expand Up @@ -493,7 +495,9 @@ def run_cart_phe(inp, filename, to_cartesian):
mix radial and angular coordinates. Thus, r_power needs to be adapted to cancel
out the radial dependence of the polynomials.
"""
r_power = trexio.read_basis_r_power(inp)

r_power = [0.0 for _ in shell_ang_mom ]

r_power_sign = -1
if to_cartesian == 0:
r_power_sign = +1
Expand Down

0 comments on commit b1f4240

Please sign in to comment.