예제 #1
0
    def request(self, parameters: Parameters, compute: bool = True) -> Path:
        self.logger.info("request wave function for parameters %s",
                         repr(parameters))

        with cwd.WorkingDir(self.working_dir.parent):
            common_parameter_names = parameters.get_common_parameter_names(
                self.prototype, )

            path = self.get_path(parameters)
            if path:
                self.logger.info("wave function is present")
                return path

            self.logger.info("wave function is not present")

            p = copy.deepcopy(self.prototype)
            for name in common_parameter_names:
                p[name] = parameters[name]

            if p not in self.missing_wave_functions:
                self.store_missing_wave_function(p)
                self.combinations = (self.stored_wave_functions +
                                     self.missing_wave_functions)

            if not compute:
                raise MissingWfnError(p)

            self._compute(p)

            return self.request(parameters, compute)
예제 #2
0
    def get_path(self, parameters: Parameters) -> Path:
        for entry, path in zip(self.parameters, self.get_paths()):
            if parameters.has_same_common_parameters(entry[1]):
                return path

        raise RuntimeError("cannot find path for parameters: " +
                           str(parameters))
예제 #3
0
 def create_parameters() -> Parameters:
     return Parameters([
         ("L", 4, "number of sites"),
         ("Jmin", -1.0, "minimal coupling constant"),
         ("Jmax", 1.0, "maximal coupling constant"),
         ("alpha", 2.0, "exponent of the interaction term"),
         ("seed", 0, "seed for the disorder"),
     ], )
예제 #4
0
 def create_parameters():
     return Parameters([
         ("N", 2, "number of particles"),
         ("m", 5, "number of single particle functions"),
         ("V0", 1.0, "depth of the Gaussian well"),
         ("x0", 0.0, "center of the Gaussian well"),
         ("g", 0.1, "strength of the contact interaction"),
     ], )
예제 #5
0
 def create_parameters() -> Parameters:
     return Parameters([
         ("sites", 4, "number of sites"),
         ("N", 4, "number of particles"),
         ("J", 1.0, "hopping constant"),
         ("U", 1.0, "interaction strength"),
         ("pbc", True, "whether to use periodic boundary conditions"),
     ], )
예제 #6
0
 def create_parameters() -> Parameters:
     return Parameters([
         ("N", 2, "number of particles"),
         ("m", 5, "number of single particle functions"),
         ("g", 0.1,
          "strength of the contact interaction between the particles"),
         ("wells", 5, "number of wells"),
         ("V0", 1.0, "depth of the lattice"),
     ], )
예제 #7
0
 def create_parameters() -> Parameters:
     return Parameters([
         ("sites", 4, "number of sites"),
         ("N", 4, "number of particles"),
         ("J", 1.0, "hopping constant"),
         ("U", 1.0, "interaction strength"),
         ("theta", numpy.pi / 2.0, "anyonic angle"),
         ("pbc", False, "whether to use periodic boundary conditions"),
     ], )
예제 #8
0
 def create_parameters() -> Parameters:
     return Parameters([
         ("N", 2, "number of particles"),
         ("m", 5, "number of single particle functions"),
         ("g", 0.1,
          "strength of the contact interaction between the particles"),
         ("omega", 1.0, "angular frequency of the harmonic trap"),
         ("x0", 0.0, "center of the harmonic trap"),
     ], )
예제 #9
0
 def create_parameters() -> Parameters:
     return Parameters(
         [
             ("Lx", 4, "width of the lattice"),
             ("Ly", 4, "height of the lattice"),
             ("delta", 1.0, "laser detuning"),
             ("Rb", 1.0, "blockade radius"),
             ("Rc", 4.0, "cutoff for long-range interactions"),
         ],
     )
예제 #10
0
파일: ising2d.py 프로젝트: f-koehler/mlxtk
 def create_parameters() -> Parameters:
     return Parameters([
         ("L", 4, "width and height of the lattice"),
         ("pbc", True, "whether to use periodic boundary conditions"),
         ("Jx", 1.0, "Ising coupling constant in x direction"),
         ("Jy", 1.0, "Ising coupling constant in y direction"),
         ("hx", 1.0, "transversal field in x direction"),
         ("hy", 0.0, "transversal field in y direction"),
         ("hz", 0.0, "longitudinal field in z direction"),
     ], )
예제 #11
0
 def create_parameters():
     return Parameters([
         ("N", 2, "number of particles"),
         ("m", 5, "number of single particle functions"),
         ("V0L", 1.0, "depth of the left Gaussian well"),
         ("V0R", 1.0, "depth of the right Gaussian well"),
         ("x0L", 0.0, "center of the left Gaussian well"),
         ("x0R", 0.0, "center of the right Gaussian well"),
         ("alpha", 1.0, "well asymmetry"),
         ("g", 0.1, "strength of the contact interaction"),
     ], )
예제 #12
0
파일: ising1d.py 프로젝트: f-koehler/mlxtk
 def create_parameters() -> Parameters:
     return Parameters(
         [
             ("L", 4, "number of sites"),
             ("pbc", True, "whether to use periodic boundary conditions"),
             ("J", 1.0, "ising coupling constant"),
             ("hx", 1.0, "transversal field in x direction"),
             ("hy", 0.0, "transversal field in y direction"),
             ("hz", 0.0, "longitudinal field in z direction"),
         ],
     )
예제 #13
0
 def create_parameters() -> Parameters:
     return Parameters(
         [
             ("L", 4, "number of sites"),
             ("J0", 1.0, "central coupling constant"),
             (
                 "function",
                 "gaussian",
                 "function for the coupling constants [uniform, exponential, gaussian]",
             ),
         ],
     )
예제 #14
0
    def get_simulation_path(self, parameters: Parameters) -> Optional[Path]:
        common_parameter_names = parameters.get_common_parameter_names(
            self.prototype)

        for p in self.stored_wave_functions:
            if p.has_same_common_parameters(parameters,
                                            common_parameter_names):
                path = self.working_dir.resolve() / "sim" / hash_string(
                    repr(p))
                return path

        return None
예제 #15
0
 def create_parameters() -> Parameters:
     return Parameters([
         ("L", 4, "number of sites"),
         ("J", 1.0, "interaction strength"),
         ("hx", 1.0, "transversal field in x direction"),
         ("hy", 0.0, "transversal field in y direction"),
         ("hz", 0.0, "longitudinal field in z direction"),
         ("alpha", 6.0, "exponent for the interaction"),
         (
             "cutoff_radius",
             -1.0,
             "cutoff_radius for the interaction (negative number => no cutoff)",
         ),
     ], )
예제 #16
0
 def create_parameters():
     return Parameters([
         ("N_A", 2, "number of A particles"),
         ("N_B", 2, "number of B particles"),
         ("M_A", 5, "number of SBSs (A species)"),
         ("M_B", 5, "number of SBSs (B species)"),
         ("m_A", 5, "number of SPFs (A species)"),
         ("m_B", 5, "number of SPFs (B species)"),
         ("mass_A", 1.0, "mass of A species particles"),
         ("mass_B", 1.0, "mass of B species particles"),
         ("g_AA", 0.1, "intra-species interaction (A species)"),
         ("g_BB", 0.1, "intra-species interaction (B species)"),
         ("g_AB", 1.0, "inter-species interaction"),
         ("V0L", 1.0, "depth of the left Gaussian well"),
         ("V0R", 1.0, "depth of the right Gaussian well"),
         ("x0L", -3.5, "center of the left Gaussian well"),
         ("x0R", 3.5, "center of the right Gaussian well"),
         ("alpha", 1.0, "well asymmetry"),
     ], )