Unverified Commit 86ac402c authored by Gao, Xiang's avatar Gao, Xiang Committed by GitHub
Browse files

delete all python2 style super calls (#14) (#540)



* delete all python2 style super calls

* flake8
Co-authored-by: default avatarIgnacio Pickering <ign.pickering@gmail.com>
parent 2e5032a4
......@@ -27,7 +27,7 @@ class Calculator(ase.calculators.calculator.Calculator):
implemented_properties = ['energy', 'forces', 'stress', 'free_energy']
def __init__(self, species, model, overwrite=False):
super(Calculator, self).__init__()
super().__init__()
self.species_to_tensor = utils.ChemicalSymbolsToInts(species)
self.model = model
self.overwrite = overwrite
......@@ -46,7 +46,7 @@ class Calculator(ase.calculators.calculator.Calculator):
def calculate(self, atoms=None, properties=['energy'],
system_changes=ase.calculators.calculator.all_changes):
super(Calculator, self).calculate(atoms, properties, system_changes)
super().calculate(atoms, properties, system_changes)
cell = torch.tensor(self.atoms.get_cell(complete=True),
dtype=self.dtype, device=self.device)
pbc = torch.tensor(self.atoms.get_pbc(), dtype=torch.bool,
......
......@@ -45,7 +45,7 @@ class BuiltinModel(torch.nn.Module):
r"""Private template for the builtin ANI models """
def __init__(self, species_converter, aev_computer, neural_networks, energy_shifter, species_to_tensor, consts, sae_dict, periodic_table_index):
super(BuiltinModel, self).__init__()
super().__init__()
self.species_converter = species_converter
self.aev_computer = aev_computer
self.neural_networks = neural_networks
......@@ -221,13 +221,8 @@ class BuiltinEnsemble(BuiltinModel):
def __init__(self, species_converter, aev_computer, neural_networks,
energy_shifter, species_to_tensor, consts, sae_dict, periodic_table_index):
super(BuiltinEnsemble, self).__init__(species_converter,
aev_computer,
neural_networks,
energy_shifter,
species_to_tensor,
consts,
sae_dict,
super().__init__(species_converter, aev_computer, neural_networks,
energy_shifter, species_to_tensor, consts, sae_dict,
periodic_table_index)
@classmethod
......
......@@ -49,7 +49,7 @@ class ANIModel(torch.nn.ModuleDict):
return od
def __init__(self, modules):
super(ANIModel, self).__init__(self.ensureOrderedDict(modules))
super().__init__(self.ensureOrderedDict(modules))
def forward(self, species_aev: Tuple[Tensor, Tensor], # type: ignore
cell: Optional[Tensor] = None,
......@@ -93,7 +93,7 @@ class Sequential(torch.nn.ModuleList):
"""Modified Sequential module that accept Tuple type as input"""
def __init__(self, *modules):
super(Sequential, self).__init__(modules)
super().__init__(modules)
def forward(self, input_: Tuple[Tensor, Tensor], # type: ignore
cell: Optional[Tensor] = None,
......
......@@ -151,7 +151,7 @@ class EnergyShifter(torch.nn.Module):
"""
def __init__(self, self_energies, fit_intercept=False):
super(EnergyShifter, self).__init__()
super().__init__()
self.fit_intercept = fit_intercept
if self_energies is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment