Exemplo n.º 1
0
    def make(self, target_dir):
        self.get_cell()

        self.cell.otherdict.update(self.merge_cell.otherdict)
        self.cell.blocks.update(self.merge_cell.blocks)

        if self.usp_pot:
            pot.add_potentials_usp(self.cell,
                                   self.pot_type,
                                   otfg_patch=self.otfg_patch)

        else:
            potentials = pot.add_potentials_asc(self.cell, self.xc_functional,
                                                self.rel_pot)

            for potential in potentials:
                potential.link_files(target_dir)

        self.params.xc_functional = self.xc_functional
        self.params.cut_off_energy = self.cut_off_energy

        if self.efg_only:
            self.params.magres_task = "efg"
        else:
            self.params.magres_task = "nmr"

        if self.target_name is None:
            self.target_name = self.source_name

        cell_target = os.path.join(target_dir, "%s.cell" % self.target_name)
        param_target = os.path.join(target_dir, "%s.param" % self.target_name)
        sh_target = os.path.join(target_dir, "%s.sh" % self.target_name)

        submission_script = SubmissionScript(self.queue, self.num_cores,
                                             self.code, self.target_name)

        with open(sh_target, "w+") as sh_target_file,\
             open(param_target, "w+") as param_target_file,\
             open(cell_target, "w+") as cell_target_file:

            print >> sh_target_file, submission_script
            print >> param_target_file, self.params
            print >> cell_target_file, self.cell
Exemplo n.º 2
0
  def make(self, target_dir):
    self.get_cell()

    self.cell.otherdict.update(self.merge_cell.otherdict)
    self.cell.blocks.update(self.merge_cell.blocks)

    if self.usp_pot:
      pot.add_potentials_usp(self.cell, self.pot_type, otfg_patch=self.otfg_patch)

    else:
      potentials = pot.add_potentials_asc(self.cell, self.xc_functional, self.rel_pot)
      
      for potential in potentials:
        potential.link_files(target_dir)

    self.params.xc_functional = self.xc_functional
    self.params.cut_off_energy = self.cut_off_energy

    if self.efg_only:
      self.params.magres_task = "efg"
    else:
      self.params.magres_task = "nmr"

    if self.target_name is None:
      self.target_name = self.source_name

    cell_target = os.path.join(target_dir, "%s.cell" % self.target_name)
    param_target = os.path.join(target_dir, "%s.param" % self.target_name)
    sh_target = os.path.join(target_dir, "%s.sh" % self.target_name)

    submission_script = SubmissionScript(self.queue,
                                         self.num_cores,
                                         self.code,
                                         self.target_name)

    with open(sh_target, "w+") as sh_target_file,\
         open(param_target, "w+") as param_target_file,\
         open(cell_target, "w+") as cell_target_file:

      print >>sh_target_file, submission_script
      print >>param_target_file, self.params
      print >>cell_target_file, self.cell
Exemplo n.º 3
0
  def make(self, target_dir):
    self.get_cell()

    self.cell.otherdict.update(self.merge_cell.otherdict)
    self.cell.blocks.update(self.merge_cell.blocks)

    if self.usp_pot:
      pot.add_potentials_usp(self.cell, "kh")

    else:
      potentials = pot.add_potentials_asc(self.cell, self.xc_functional, True)
      
      for potential in potentials:
        potential.link_files(target_dir)

    add_constraints(self.cell, self.filter)

    self.params.xc_functional = self.xc_functional
    self.params.cut_off_energy = self.cut_off_energy

    if self.target_name is None:
      self.target_name = self.source_name

    cell_target = os.path.join(target_dir, "%s.cell" % self.target_name)
    param_target = os.path.join(target_dir, "%s.param" % self.target_name)
    sh_target = os.path.join(target_dir, "%s.sh" % self.target_name)

    submission_script = SubmissionScript(self.queue,
                                         self.num_cores,
                                         self.code,
                                         self.target_name)

    with open(sh_target, "w+") as sh_target_file,\
         open(param_target, "w+") as param_target_file,\
         open(cell_target, "w+") as cell_target_file:

      print >>sh_target_file, submission_script
      print >>param_target_file, self.params
      print >>cell_target_file, self.cell
Exemplo n.º 4
0
    def make(self, target_dir):
        self.get_cell()

        self.cell.otherdict.update(self.merge_cell.otherdict)
        self.cell.blocks.update(self.merge_cell.blocks)

        if self.usp_pot:
            pot.add_potentials_usp(self.cell, "kh")

        else:
            potentials = pot.add_potentials_asc(self.cell, self.xc_functional,
                                                True)

            for potential in potentials:
                potential.link_files(target_dir)

        add_constraints(self.cell, self.filter)

        self.params.xc_functional = self.xc_functional
        self.params.cut_off_energy = self.cut_off_energy

        if self.target_name is None:
            self.target_name = self.source_name

        cell_target = os.path.join(target_dir, "%s.cell" % self.target_name)
        param_target = os.path.join(target_dir, "%s.param" % self.target_name)
        sh_target = os.path.join(target_dir, "%s.sh" % self.target_name)

        submission_script = SubmissionScript(self.queue, self.num_cores,
                                             self.code, self.target_name)

        with open(sh_target, "w+") as sh_target_file,\
             open(param_target, "w+") as param_target_file,\
             open(cell_target, "w+") as cell_target_file:

            print >> sh_target_file, submission_script
            print >> param_target_file, self.params
            print >> cell_target_file, self.cell
Exemplo n.º 5
0
  def make(self, target_dir):
    """
      Write the calculation to the specified target directory.
    """

    self.get_cell()

    # Get the J-coupling site if we don't have it already
    if self.jc_s is None:
      self.get_jcoupling_site(target_dir) 

    # Set up the site in the cell
    if self.jc_s is not None:
      try:
        jc_ion = cell.ions.species(self.jc_s)[self.jc_i-1]
      except IndexError:
        raise SiteNotPresent("Site {:s} {:d} not present".format(self.jc_s, self.jc_i))
    
      cell.otherdict['jcoupling_site'] = "{:s} {:d}".format(self.jc_s, self.jc_i)

    # Remove extraneous kpoints and add in default cell setup
    if 'KPOINTS_LIST' in cell.blocks:
      del cell.blocks['KPOINTS_LIST']
    
    self.cell.otherdict.update(self.merge_cell.otherdict)
    
    # Sort out .param file
    self.params.xc_functional = self.xc_functional
    self.params.cut_off_energy = self.cut_off_energy

    # Add pseudopotentials
    if self.usp_pot:
      pot.add_potentials_usp(cell, self.rel_pot)
    else:
      potentials = pot.add_potentials_asc(cell, self.xc_functional, self.rel_pot)

      for potential in potentials:
        potential.link_files(target_dir)
    
    # Generate submission script and write all the files out
    target_name = source_name

    cell_target = os.path.join(target_dir, "%s.cell" % target_name)
    param_target = os.path.join(target_dir, "%s.param" % target_name)
    sh_target = os.path.join(target_dir, "%s.sh" % target_name)

    submission_script = SubmissionScript(self.queue,
                                         self.num_cores,
                                         self.code,
                                         target_name)

    sh_target_file = open(sh_target, "w+")
    param_target_file = open(param_target, "w+")
    cell_target_file = open(cell_target, "w+")

    print >>sh_target_file, submission_script
    print >>param_target_file, self.params
    print >>cell_target_file, cell

    sh_target_file.close()
    param_target_file.close()
    cell_target_file.close()