def fill_order(self, order): if self.filled_for_order[order-1]: return #----------------------------------------# tens = self.tensors[order] if order <= self.max_analytic_order: #TODO this will need to be significantly modified for hessians and higher, since the transformation to interal coordinates requires all lower derivatives as well... tens[...] = self.base_molecule.get_property( PropertyDerivative(self.molecular_property, order) if order > 0 else self.molecular_property, details=self.displacement_manager.details ).value.in_representation(self.representation) #----------------------------------------# else: for f_coords in symmetric_product(self.representation, order-self.max_analytic_order): if self.max_analytic_order == 0 or isinstance(self.representation, CartesianRepresentation): spread_val = FiniteDifferenceDerivative( self.displacement_manager, *f_coords, target_robustness=self.robustness ).value else: spread_val = RepresentationDependentTensor( FiniteDifferenceDerivative( self.displacement_manager, *f_coords, target_robustness=self.robustness ).value, representation=self.representation.molecule.cartesian_representation ) spread_val = spread_val.in_representation(self.representation) for perm in permutations(f_coords): tens[perm] = spread_val #----------------------------------------# self.filled_for_order[order-1] = True
def fill_order(self, order): if self.filled_for_order[order - 1]: return #----------------------------------------# tens = self.tensors[order] if order <= self.max_analytic_order: #TODO this will need to be significantly modified for hessians and higher, since the transformation to interal coordinates requires all lower derivatives as well... tens[...] = self.base_molecule.get_property( PropertyDerivative(self.molecular_property, order) if order > 0 else self.molecular_property, details=self.displacement_manager.details ).value.in_representation(self.representation) #----------------------------------------# else: for f_coords in symmetric_product(self.representation, order - self.max_analytic_order): if self.max_analytic_order == 0 or isinstance( self.representation, CartesianRepresentation): spread_val = FiniteDifferenceDerivative( self.displacement_manager, *f_coords, target_robustness=self.robustness).value else: spread_val = RepresentationDependentTensor( FiniteDifferenceDerivative( self.displacement_manager, *f_coords, target_robustness=self.robustness).value, representation=self.representation.molecule. cartesian_representation) spread_val = spread_val.in_representation( self.representation) for perm in permutations(f_coords): tens[perm] = spread_val #----------------------------------------# self.filled_for_order[order - 1] = True