예제 #1
0
def get_pe_value(lmplog, entry_idx=-1, energy_idx=-1):
    """
    Bla.

    Pull energy value from lammps calculation.
    """
    log_data = agul.LogUnification()
    log_data.read_lmplog(lmplog)
    return log_data.data[entry_idx]["PotEng"][energy_idx]
예제 #2
0
def get_energies(lmplog):
    """
    """
    pot_energies = []
    coul_energies = []
    vdw_energies = []
    intra_energies = []

    log_data = agul.LogUnification()
    log_data.read_lmplog(lmplog)

    for entry in log_data.data:
        pot_energies.append(entry["PotEng"][-1])
        coul_energies.append(entry["E_coul"][-1])
        vdw_energies.append(entry["E_vdwl"][-1])
        intra_energies.append(entry["E_bond"][-1] + entry["E_angle"][-1] +
                              entry["E_dihed"][-1] + entry["E_impro"][-1])

    return (pot_energies, coul_energies, vdw_energies, intra_energies)
예제 #3
0
    def process_lmp(self, lmplog, dcd, idxs1, idxs2, frame=-1):
        """
        Extract the distance and energy from lammps output done by using 'displace_atoms' command in lammps.

        This method is reading ONE output file for the energy and for the coordinates
        which has several geometries that were optimized or single point calculations
        were carried out on.
        """
        log_data = agul.LogUnification()
        log_data.read_lmplog(lmplog)
        dimer_sys = agum.Unification()
        dimer_sys.import_dcd(dcd)
        dimer_sys.read_frames()
        nframes = range(len(dimer_sys.ts_coords))

        for frame_id in nframes:
            distance = self._get_distance(dimer_sys, idxs1, idxs2, frame_id)
            energy = log_data.data[frame_id]["PotEng"][frame]
            self.results.append((distance, energy))

        self._norm_results()
예제 #4
0
# xmgrace, etc.

parser = argparse.ArgumentParser(
    prog="log2clmsv.py",
    formatter_class=argparse.RawTextHelpFormatter,
    description="Read one or more log.lammps and " +
    "convert them to clmsv files. " + "Entries are split to enumerated files.")

parser.add_argument("log",
                    metavar="log.lammps",
                    nargs="*",
                    help="Column separated files containing values " +
                    "for several keywords")

parser.add_argument("-out",
                    action="store",
                    required=True,
                    help="Output name for clmsv-files.")

parser.add_argument("-s",
                    "--split",
                    action="store_true",
                    help="If log.lammps consists of several entries, " +
                    "split output into multiple clmsv-files.")

args = parser.parse_args()

a = agul.LogUnification()
a.read_lmplog(*args.log)
a.write_clmsv(args.out, split=args.split)
예제 #5
0
parser.add_argument(
    "-mean",
    action="store_true",
    default=False,
    help="calculate the mean from '-start' to '-stop' of the y-values")

parser.add_argument(
    "-median",
    action="store_true",
    default=False,
    help="calculate the median from '-start' to '-stop' of the y-values")

args = parser.parse_args()

# read clmsv
clmsv = agul.LogUnification()
clmsv.read_clmsv(args.clmsv)
#print("***Warning: Currently only the first entry of each clmsv will be plotted!")
#data = clmsv.data[0]

data = collections.OrderedDict()

# merge if multiple files were given
for cdict in clmsv.data:
    for key, value in cdict.items():
        if key not in data:
            data[key] = []

        data[key].extend(value)

keys = list(data.keys())