git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12769 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
47
tools/i-pi/ipi/utils/io/io_binary.py
Normal file
47
tools/i-pi/ipi/utils/io/io_binary.py
Normal file
@ -0,0 +1,47 @@
|
||||
"""Contains the functions used to print the trajectories and read input
|
||||
configurations (or even full status dump) as unformatted binary.
|
||||
|
||||
Copyright (C) 2013, Joshua More and Michele Ceriotti
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http.//www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
Functions:
|
||||
print_bin: Prints an atomic configuration.
|
||||
"""
|
||||
|
||||
__all__ = ['print_bin']
|
||||
|
||||
import os
|
||||
import numpy as np
|
||||
import math, sys
|
||||
from ipi.utils.depend import depstrip
|
||||
|
||||
def print_bin(atoms, cell, filedesc = sys.stdout, title=""):
|
||||
"""Prints the centroid configurations, into a binary file.
|
||||
|
||||
Args:
|
||||
beads: An atoms object giving the centroid positions.
|
||||
cell: A cell object giving the system box.
|
||||
filedesc: An open writable file object. Defaults to standard output.
|
||||
title: This gives a string to be appended to the comment line.
|
||||
"""
|
||||
|
||||
buff = filedesc # .buffer
|
||||
cell.h.tofile(buff)
|
||||
nat = np.asarray([atoms.natoms])
|
||||
nat.tofile(buff)
|
||||
atoms.names.tofile(buff)
|
||||
atoms.q.tofile(buff)
|
||||
|
||||
Reference in New Issue
Block a user