Пример #1
0
    def check_state(self, atoms, tol=1e-15):
        """Check for system changes since last calculation."""
        def compare_dict(d1, d2):
            """Helper function to compare dictionaries"""
            # Use symmetric difference to find keys which aren't shared
            # for python 2.7 compatiblity
            if set(d1.keys()) ^ set(d2.keys()):
                return False

            # Check for differences in values
            for key, value in d1.items():
                if np.any(value != d2[key]):
                    return False
            return True

        # First we check for default changes
        system_changes = Calculator.check_state(self, atoms, tol=tol)

        # We now check if we have made any changes to the input parameters
        # XXX: Should we add these parameters to all_changes?
        for param_string, old_dict in self.param_state.items():
            param_dict = getattr(self, param_string)  # Get current param dict
            if not compare_dict(param_dict, old_dict):
                system_changes.append(param_string)

        return system_changes
Пример #2
0
 def check_state(self, atoms, tol=1.0e-10):
     # Transforming the unit cell to conform to LAMMPS' convention for
     # orientation (c.f. https://lammps.sandia.gov/doc/Howto_triclinic.html)
     # results in some precision loss, so we use bit larger tolerance than
     # machine precision here.  Note that there can also be precision loss
     # related to how many significant digits are specified for things in
     # the LAMMPS input file.
     return Calculator.check_state(self, atoms, tol)
Пример #3
0
 def check_state(self, atoms, tol=1e-15):
     system_changes = Calculator.check_state(self, atoms, tol)
     if 'positions' not in system_changes:
         if self.hamiltonian:
             if self.hamiltonian.vext:
                 if self.hamiltonian.vext.vext_g is None:
                     # QMMM atoms have moved:
                     system_changes.append('positions')
     return system_changes
Пример #4
0
 def check_state(self, atoms):
     system_changes = Calculator.check_state(self, atoms)
     # Ignore boundary conditions:
     if 'pbc' in system_changes:
         system_changes.remove('pbc')
     # There's no periodicity in psi4
     if 'cell' in system_changes:
         system_changes.remove('cell')
     return system_changes
Пример #5
0
 def check_state(self, atoms, tol=1e-15):
     system_changes = Calculator.check_state(self, atoms, tol)
     if self.pcpot and self.pcpot.mmpositions is not None:
         system_changes.append('positions')
     return system_changes
Пример #6
0
 def check_state(self, atoms, tol=1e-15):
     if self.calculation_always_required:
         return all_changes
     return Calculator.check_state(self, atoms, tol)
Пример #7
0
 def check_state(self, atoms, tol=1e-15):
     system_changes = Calculator.check_state(self, atoms, tol)
     if self.pcpot and self.pcpot.mmpositions is not None:
         system_changes.append('positions')
     return system_changes
Пример #8
0
 def check_state(self, atoms):
     system_changes = Calculator.check_state(self, atoms)
     return system_changes