Ejemplo n.º 1
0
    def bind(self, simul):
        """Binds output proxy to simulation object.

        Args:
           simul: A simulation object to be bound.
        """

        self.simul = simul
        import ipi.inputs.simulation as isimulation
        self.status = isimulation.InputSimulation()
        self.status.store(simul)
Ejemplo n.º 2
0
    def load_from_xml(fn_input,
                      custom_verbosity=None,
                      request_banner=False,
                      read_only=False):
        """Load an XML input file and return a `Simulation` object.

        Arguments:
            fn_input (str): Name of the input file.
            custom_verbosity (str): If not `None`, overrides the verbosity
                specified by the input file.
            request_banner (bool): Whether to print the i-PI banner,
                if verbosity is higher than 'quiet'.
        """

        # parse the file
        xmlrestart = xml_parse_file(open(fn_input))

        # prepare the simulation input object
        input_simulation = isimulation.InputSimulation()

        # check the input and partition it appropriately
        input_simulation.parse(xmlrestart.fields[0][1])

        # override verbosity if requested
        if custom_verbosity is None:
            # Get from the input file
            custom_verbosity = input_simulation.verbosity.fetch()
        input_simulation.verbosity.value = custom_verbosity

        # print banner if not suppressed and simulation verbose enough
        if request_banner and input_simulation.verbosity.value != "quiet":
            banner()

        # create the simulation object
        simulation = input_simulation.fetch()

        # pipe between the components of the simulation
        simulation.bind(read_only)

        # echo the input file if verbose enough
        if verbosity.level > 0:
            print(" # i-PI loaded input file: ", fn_input)
        if verbosity.level > 1:
            print(" --- begin input file content ---")
            ifile = open(fn_input, "r")
            for line in ifile.readlines():
                print(line, end=" ")
            print(" ---  end input file content  ---")
            ifile.close()

        return simulation
Ejemplo n.º 3
0
src_dir = "../"

sys.path.append(src_dir)

from ipi.inputs import barostats, cell, simulation, system, \
    ensembles, thermostats, forcefields, forces, atoms, beads, \
    prng, initializer, normalmodes, outputs, motion, smotion

time.sleep(1)
__all__ = ['help', 'objects']

objects = {
    'barostats': barostats.InputBaro(),
    'cell': cell.InputCell(),
    'simulation': simulation.InputSimulation(),
    'smotion': smotion.smotion.InputSmotion(),
    'remd': smotion.remd.InputReplicaExchange(),
    'meta': smotion.metad.InputMetaDyn(),
    'system': system.InputSystem(),
    'ensembles': ensembles.InputEnsemble(),
    'motion': motion.motion.InputMotion(),
    'dynamics': motion.dynamics.InputDynamics(),
    'alchemy': motion.alchemy.InputAlchemy(),
    'instanton': motion.instanton.InputInst(),
    'phonons': motion.phonons.InputDynMatrix(),
    'geop': motion.geop.InputGeop(),
    'neb': motion.neb.InputNEB(),
    'thermostats': thermostats.InputThermo(),
    'forcefield': forcefields.InputForceField(),
    'ffsocket': forcefields.InputFFSocket(),
Ejemplo n.º 4
0
    outputs,
    motion,
    smotion,
)

src_dir = "../"
sys.path.append(src_dir)


time.sleep(1)
__all__ = ["help", "objects"]

objects = {
    "barostats": barostats.InputBaro(),
    "cell": cell.InputCell(),
    "simulation": simulation.InputSimulation(),
    "smotion": smotion.smotion.InputSmotion(),
    "remd": smotion.remd.InputReplicaExchange(),
    "meta": smotion.metad.InputMetaDyn(),
    "system": system.InputSystem(),
    "ensembles": ensembles.InputEnsemble(),
    "motion": motion.motion.InputMotion(),
    "dynamics": motion.dynamics.InputDynamics(),
    "t_ramp": motion.ramp.InputTemperatureRamp(),
    "p_ramp": motion.ramp.InputPressureRamp(),
    "alchemy": motion.alchemy.InputAlchemy(),
    "planetary": motion.planetary.InputPlanetary(),
    "atomswap": motion.atomswap.InputAtomSwap(),
    "instanton": motion.instanton.InputInst(),
    "phonons": motion.phonons.InputDynMatrix(),
    "geop": motion.geop.InputGeop(),