Skip to content

Commit

Permalink
updated a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
kosuke-nakano committed Jun 10, 2024
1 parent 0e97fcc commit 136f297
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 6 deletions.
11 changes: 11 additions & 0 deletions turbogenius/pyturbo/basis_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ def __init__(
)

if not all(check_flags):
logger.error(f'-------------they should be equal-------------')
logger.error(f'len(self.exponent) = {len(self.exponent)}')
logger.error(f'len(self.coefficient) = {len(self.coefficient)}')
logger.error(f'len(self.prim_factor) = {len(self.prim_factor)}')
logger.error(f'len(self.shell_index) = {len(self.shell_index)}')
logger.error(f'-------------they should be equal-------------')
logger.error(f'len(self.nucleus_index) = {len(self.nucleus_index)}')
logger.error(f'len(self.shell_ang_mom) = {len(self.shell_ang_mom)}')
logger.error(f'len(self.shell_ang_mom_turbo_notation) = {len(self.shell_ang_mom_turbo_notation)}')
logger.error(f'self.shell_ang_mom={self.shell_ang_mom}')
logger.error(f'self.shell_ang_mom_turbo_notation={self.shell_ang_mom_turbo_notation}')
raise ValueError

def __str__(self) -> str:
Expand Down
10 changes: 9 additions & 1 deletion turbogenius/pyturbo/io_fort10.py
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,8 @@ def mo_coefficient(self, new_mo_coefficient):
# logger.debug(len(new_mo_coefficient))
# logger.debug(len(self.__mo_coefficient))
# logger.debug(new_mo_coefficient[0][-1])
logger.info(f'Replacing MO coeffs (real). num = {len(new_mo_coefficient)}')
logger.info(f'num total = {np.sum([len(mos) for mos in new_mo_coefficient])}')
assert len(new_mo_coefficient) == len(self.__mo_coefficient)
total_num_sed = len(new_mo_coefficient) * len(new_mo_coefficient[0])
logger.debug(f"Total num sed = {total_num_sed}")
Expand All @@ -1657,6 +1659,8 @@ def mo_coefficient(self, new_mo_coefficient):
@mo_coefficient_imag.setter
def mo_coefficient_imag(self, new_mo_coefficient_imag):
self.read()
logger.info(f'Replacing MO coeffs (imag). num = {len(new_mo_coefficient_imag)}')
logger.info(f'num total = {np.sum([len(mos) for mos in new_mo_coefficient_imag])}')
# logger.debug(len(new_mo_coefficient))
# logger.debug(len(self.__mo_coefficient_imag))
# logger.debug(new_mo_coefficient[0][-1])
Expand Down Expand Up @@ -2002,7 +2006,7 @@ def read(self):

orb_type_chr = str(return_orb_type_chr(shell_ang_mom_turbo_notation.v))

if orb_type_chr in {"s", "p", "d", "f", "g", "h", "i"}:
if orb_type_chr in {"s", "s100", "s131", "p", "p103", "p150", "d", "f", "g", "h", "i"}:
contraction_flag = return_contraction_flag(
shell_ang_mom_turbo_notation.v
)
Expand All @@ -2027,6 +2031,10 @@ def read(self):
self.__shell_index.append(shell_index)
self.__exponent.append(Value())
self.__coefficient.append(Value())

else:
raise NotImplementedError


p = p[4 + param_num.v :]

Expand Down
11 changes: 8 additions & 3 deletions turbogenius/pyturbo/makefort10.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ def generate_input(self, input_name: str, basis_sets_unique_element: bool = True
atomic_number = self.structure.atomic_numbers[num]

if self.structure.has_celldm:
logger.warning("Cartesian coord.")
#logger.warning("Cartesian coord.")
x, y, z = self.structure.positions[num]
else:
logger.warning("Fractional coord.")
#logger.warning("Fractional coord.")
x, y, z = self.structure.positions_frac[num]

# we need this operation even if basis_sets_unique_element is True
Expand Down Expand Up @@ -543,7 +543,12 @@ def read_default_namelist(

# twobody part
for i in range(num_twobody):
namelist.set_parameter(f"twobodypar({i+1})", 0.5, "&electrons")
if jastrow_type == -15:
namelist.set_parameter(f"twobodypar({i+1})", 0.5, "&electrons")
elif jastrow_type == -6:
namelist.set_parameter(f"twobodypar({i+1})", 1.0, "&electrons")
else:
namelist.set_parameter(f"twobodypar({i+1})", 0.5, "&electrons")
namelist.comment_out("twobodypar")

# spin (i.e., neldiff)
Expand Down
7 changes: 6 additions & 1 deletion turbogenius/pyturbo/pseudopotentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ def __init__(
logger.debug(f"power={self.power}")

# assertion!!
assert len(set(self.nucleus_index)) == len(self.max_ang_mom_plus_1)
if len(set(self.nucleus_index)) != len(self.max_ang_mom_plus_1):
logger.error(f"set(self.nucleus_index) = {set(self.nucleus_index)}")
logger.error(f"len(self.max_ang_mom_plus_1) = {len(self.max_ang_mom_plus_1)}")
logger.error(f"self.nucleus_index = {self.nucleus_index}")
logger.error(f"self.max_ang_mom_plus_1 = {self.max_ang_mom_plus_1}")
raise ValueError
assert len(set(self.nucleus_index)) == len(self.z_core)
assert len(set(self.nucleus_index)) == len(self.cutoff)
assert len(self.ang_mom) == len(self.exponent)
Expand Down
7 changes: 6 additions & 1 deletion turbogenius/pyturbo/utils/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ def return_element_symbol(atomic_number):

def return_atomic_number(element):
element = str(element)
return Element(element).number
try:
E = Element(element)
number = E.number
except ValueError:
number = 0.0
return number


def remove_file(file):
Expand Down
1 change: 1 addition & 0 deletions turbogenius/trexio_to_turborvb.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def trexio_to_turborvb_wf(

# Pseudopotentials
if has_ecp:
logger.info(f"ecp_z_core={ecp_z_core}")
cutoff = [0.0] * len(ecp_z_core)
pseudopotentials = Pseudopotentials(
max_ang_mom_plus_1=ecp_max_ang_mom_plus_1,
Expand Down

0 comments on commit 136f297

Please sign in to comment.