Ejemplo n.º 1
0
    def __init__(self):
        """
        Class to interface commands with HPC
        """

        config = load_config()['HPC']

        for key, value in config.items():
            setattr(self, key, value)
Ejemplo n.º 2
0
    def __init__(self, **kwargs):
        """
        Parameters
        ----------
        **kwargs : 
            project_id: (str) Project ID \n
            name: (str) Job name \n
            array_size: (int) Number of jobs for array \n
            email: (str) Email address for info \n
            nodes: (int) Number of nodes \n
            cores_per_node: (int) Number of cores per node \n
            output_filename: (str) Filename of output file \n
            error_filename: (str) Filename of error file \n
            timelimit: (int) Time limit in hours \n
            memory_per_cpu:(int) Memory settings
            partition (str) Partition
            processor: (str) CPU architecture
            modules: (list) List of modules to be loaded
            path_exe: (str) Path to executable \n             
            add_stop_array : (Bool), Add lines for stopping array jobs when calculation is converged. \n                
                If True is effective only if key 'array_size' is not None
            add_automation : (str) , Automation script to add to the file.                
            add_lines_header : (List) , Lines to add in the header part of the file.
            add_lines_body : (List) , Lines to add in the body part of the file.
        """

        config = load_config()
        default_settings = config['job_settings']

        for key, value in default_settings.items():
            setattr(self, key, value)

        for key, value in kwargs.items():
            if key in default_settings:
                setattr(self, key, value)
            else:
                raise Exception(
                    '"%s" is not a possible argument \nPossible arguments are: %s'
                    % (key, self.settings.keys()))
Ejemplo n.º 3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov  9 11:12:09 2020

@author: villa
"""


from matgendb.creator import VaspToDbTaskDrone
from pynter.__init__ import load_config

dbconfig = load_config()['dbconfig']

# for VaspJob we use pymatgen-db interface
class VaspJobDrone(VaspToDbTaskDrone):
    """
    Subclass of VaspToDbTaskDrone in pymatgen-db (matgendb) package.
    To set up the database for VaspJob we use the pymatgen-db package which already provides a useful
    interface to the other pymatgen objects that are already used (like Structure or ComputedEntry).
    This class helps to interface a VaspJob object with the database.
    For documentation on input args (https://github.com/materialsproject/pymatgen-db/blob/master/matgendb/creator.py).
    Warning: 'use_full_uri' has been set to False here to allow interface with VaspJob objects.
    """
    def __init__(self, job, **kwargs):
        
        for k,v in dbconfig['vasp'].items():
            if k not in kwargs:
                kwargs[k] = v
                   
        super().__init__(use_full_uri=False,**kwargs)
Ejemplo n.º 4
0
#!/usr/bin/env python

import os
import os.path as op
import time
from datetime import datetime
import subprocess
import schedule
from pynter.__init__ import load_config

config = load_config()
hostname = config['HPC']['hostname']
workdir = config['HPC']['workdir']
localdir = config['HPC']['localdir']
workdir = op.join(workdir, '')  #ensure backslash at the end
localdir = op.join(localdir, '')

homedir = os.getenv("HOME")
wdir = os.path.join(homedir, '.sync_hpc')
if not os.path.exists(wdir):
    os.makedirs(wdir)
os.chdir(wdir)

command = f"rsync -r -uavzh --exclude='core.*' --exclude='WAVECAR' -e ssh {hostname}:{workdir}  {localdir}"
command = command.split(
)  #subprocess.run() takes a list with the arguments of the command


def job(command):

    proc = subprocess.run(command, capture_output=True, shell=False, text=True)
Ejemplo n.º 5
0
#!/usr/bin/env python

from pymatgen.ext.matproj import MPRester
from pymatgen.io.vasp.inputs import Poscar
import argparse as ap
from pynter.__init__ import load_config

API_KEY = load_config()['API_KEY']

with MPRester(API_KEY) as mpr:

    class MPDatabase:
        def __init__(self, mp_id=None):
            """
            Class to retrieve data from Materials Project database

            Parameters
            ----------
            mp_id : (str), optional
                Materials-ID. The default is None.
            """

            self.mp_id = mp_id if mp_id else None
            self.api_key = API_KEY

        @property
        def mp_rester(self):
            return mpr

        def args(self):
            """