Skip to content

Commit

Permalink
run black
Browse files Browse the repository at this point in the history
  • Loading branch information
samwaseda committed Oct 5, 2024
1 parent 50230db commit 54d5420
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 31 deletions.
41 changes: 18 additions & 23 deletions stinx/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ def create(
main: Optional[dict] = None,
):
"""
Args:
structure (dict): (Optional)
basis (dict): (Optional)
pawPot (dict): The pawPot group defines the PAW potentials, by a sequence of species groups. The order of species must agree with the structure group. (Optional)
PAWHamiltonian (dict): (Optional)
spinConstraint (dict): (Optional)
initialGuess (dict): In order to start a DFT calculations, one must set up an initial guess for the density and for the wave functions. The initialGuess group defines how this is done, as well as a few other settings (such as keeping the waves on disk to save RAM). The default is to set up the density from a superposition of atomic densities, and the wave-functions from a single-step LCAO calculation, using the atomic valence orbitals. This works exceptionally well. If you want to finetune the behavior, the initialGuess group must contain a waves or a rho group. Otherwise, you may omit the waves and rho groups to get the default behavior. Additionally, the initialGuess group may contain an occupations group to set up initial occupations (notably when keeping them fixed), and an exchange group for hybrid functionals. (Optional)
pseudoPot (dict): The pseudoPot group defines the norm-conserving pseudopotentials by a sequence of species groups. The order of species must agree with the structure group.
Note: PAW and norm-conserving pseudopotentials cannot be mixed. Using pseudoPot requires to use PWHamiltonian to define the Hamiltonian. (Optional)
PWHamiltonian (dict): (Optional)
main (dict): (Optional)
Args:
structure (dict): (Optional)
basis (dict): (Optional)
pawPot (dict): The pawPot group defines the PAW potentials, by a sequence of species groups. The order of species must agree with the structure group. (Optional)
PAWHamiltonian (dict): (Optional)
spinConstraint (dict): (Optional)
initialGuess (dict): In order to start a DFT calculations, one must set up an initial guess for the density and for the wave functions. The initialGuess group defines how this is done, as well as a few other settings (such as keeping the waves on disk to save RAM). The default is to set up the density from a superposition of atomic densities, and the wave-functions from a single-step LCAO calculation, using the atomic valence orbitals. This works exceptionally well. If you want to finetune the behavior, the initialGuess group must contain a waves or a rho group. Otherwise, you may omit the waves and rho groups to get the default behavior. Additionally, the initialGuess group may contain an occupations group to set up initial occupations (notably when keeping them fixed), and an exchange group for hybrid functionals. (Optional)
pseudoPot (dict): The pseudoPot group defines the norm-conserving pseudopotentials by a sequence of species groups. The order of species must agree with the structure group.
Note: PAW and norm-conserving pseudopotentials cannot be mixed. Using pseudoPot requires to use PWHamiltonian to define the Hamiltonian. (Optional)
PWHamiltonian (dict): (Optional)
main (dict): (Optional)
"""
return fill_values(
structure=structure,
Expand Down Expand Up @@ -873,12 +873,12 @@ def create(
species: Optional[dict] = None,
):
"""
The pseudoPot group defines the norm-conserving pseudopotentials by a sequence of species groups. The order of species must agree with the structure group.
The pseudoPot group defines the norm-conserving pseudopotentials by a sequence of species groups. The order of species must agree with the structure group.
Note: PAW and norm-conserving pseudopotentials cannot be mixed. Using pseudoPot requires to use PWHamiltonian to define the Hamiltonian.
Note: PAW and norm-conserving pseudopotentials cannot be mixed. Using pseudoPot requires to use PWHamiltonian to define the Hamiltonian.
Args:
species (dict): (Optional)
Args:
species (dict): (Optional)
"""
return fill_values(
species=species,
Expand Down Expand Up @@ -969,9 +969,7 @@ def create(

class main:
@staticmethod
def create(
**kwargs
):
def create(**kwargs):
"""
Args:
scfDiag (dict): The scfDiag group selects and controls the iterative diagonalization + density mixing algorithm for the solution of the Kohn-Sham DFT equations. (Optional)
Expand All @@ -981,9 +979,7 @@ def create(
ric (dict): The ric group defines the parameters for internal coordinate generation. (Optional)
ricTS (dict): The ricTS group requests a quasi-Newton optimization for 1st-order saddle points (transition states) using updates [11] of an on-the-fly optimized internal-coordinate based initial guess for the Hessian [10]. An initial guess for the reaction coordinate must be known. Note: This is an experimental feature. The optimization should be started within the saddle point region (one negative eigenvalue of the Hesse matrix), otherwise, the algorithm may converge to a different stationary point (a minimum, or a higher-order saddle point). (Optional)
"""
return fill_values(
**kwargs
)
return fill_values(**kwargs)

class scfDiag:
@staticmethod
Expand Down Expand Up @@ -2296,4 +2292,3 @@ def create(
spinScaling=spinScaling,
dielecConstant=dielecConstant,
)

8 changes: 2 additions & 6 deletions stinx/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ def collect_energy_struct(file_name="energy-structOpt.dat", cwd=None):
path = Path(file_name)
if cwd is not None:
path = Path(cwd) / path
return {
"energy_free": np.loadtxt(str(path), ndmin=2).reshape(-1, 2)[:, 1]
}
return {"energy_free": np.loadtxt(str(path), ndmin=2).reshape(-1, 2)[:, 1]}


def _check_permutation(index_permutation):
Expand Down Expand Up @@ -282,9 +280,7 @@ def get_bands_k_weights(self):
@property
def _rec_cell(self):
log_extract = re.findall("b[1-3]:.*$", self.log_file, re.MULTILINE)
return (
np.array([ll.split()[1:4] for ll in log_extract]).astype(float)
)[:3]
return (np.array([ll.split()[1:4] for ll in log_extract]).astype(float))[:3]

def get_kpoints_cartesian(self):
return np.einsum("ni,ij->nj", self.k_points, self._rec_cell)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ def test_stinx(self):
self.assertTrue("def create" in generator.get_class(all_data))


if __name__ == '__main__':
if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion tests/unit/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ def test_output(self):
self.assertIsInstance(energy["scf_energy_free"], list)


if __name__ == '__main__':
if __name__ == "__main__":
unittest.main()

0 comments on commit 54d5420

Please sign in to comment.