Beispiel #1
0
 def get_structure_from_file(self, myfilepath=""):
     """Get the structure from a specified file path.
         For LAMMPS, this is a trajectory-type file.
         Args:
             myfilepath <str>: File path for structure.
     """
     dir = os.path.dirname(myfilepath)
     if dir == '':
         dir = os.getcwd()
     filelist = os.listdir(dir)
     atomsymbolsfile = None
     for onefile in filelist:
         if 'atom_symbols' in onefile:
             atomsymbolsfile = os.path.join(dir, onefile)
     #Read the atom types from the atoms symbol file
     f = open(atomsymbolsfile, 'r')
     atomslist = list()
     for line in f.readlines():
         atomslist.append(line.strip())
     f.close()
     if "DATA" in myfilepath:
         atms = read_lammps_data(myfilepath, atomslist)
     elif "TRAJECTORY" in myfilepath:
         atms, velocities, forces = read_lammps_trajectory(
             myfilepath, -1, atomslist)
     else:
         raise MASTError(
             self.__class__.__name__,
             "Unknown file type for receiving structure from LAMMPS: %s" %
             myfilepath)
     return AseAtomsAdaptor.get_structure(atms)
Beispiel #2
0
 def get_structure_from_file(self, myfilepath=""):
     """Get the structure from a specified file path.
         For LAMMPS, this is a trajectory-type file.
         Args:
             myfilepath <str>: File path for structure.
     """
     dir = os.path.dirname(myfilepath)
     if dir == '':
         dir = os.getcwd()
     filelist = os.listdir(dir)
     atomsymbolsfile = None
     for onefile in filelist:
         if 'atom_symbols' in onefile:
             atomsymbolsfile = os.path.join(dir, onefile)
     #Read the atom types from the atoms symbol file
     f = open(atomsymbolsfile, 'r')
     atomslist = list()
     for line in f.readlines():
         atomslist.append(line.strip())
     f.close()
     if "DATA" in myfilepath:
         atms = read_lammps_data(myfilepath,atomslist)
     elif "TRAJECTORY" in myfilepath:
         atms,velocities,forces = read_lammps_trajectory(myfilepath,-1,atomslist)
     else:
         raise MASTError(self.__class__.__name__,
             "Unknown file type for receiving structure from LAMMPS: %s" % myfilepath)
     return AseAtomsAdaptor.get_structure(atms)
Beispiel #3
0
 def get_initial_structure_from_directory(self, mydir=""):
     """Get the structure from a specified file path.
         For LAMMPS, this is a data-type file.
         Args:
             myfilepath <str>: File path for structure.
     """
     dir = os.path.dirname(myfilepath)
     filelist = os.listdir(dir)
     atomsymbolsfile = None
     for onefile in filelist:
         if 'atom_symbols' in onefile:
             atomsymbolsfile = os.path.join(dir, onefile)
     #Read the atom types from the atoms symbol file
     f = open(atomsymbolsfile)
     atomslist = list()
     for line in f.readlines():
         atomslist.append(line.strip())
     f.close()
     atms = read_lammps_data(myfilepath, atomslist)
     return AseAtomsAdaptor.get_structure(atms)
Beispiel #4
0
 def get_initial_structure_from_directory(self,mydir=""):
     """Get the structure from a specified file path.
         For LAMMPS, this is a data-type file.
         Args:
             myfilepath <str>: File path for structure.
     """
     dir = os.path.dirname(myfilepath)
     filelist = os.listdir(dir)
     atomsymbolsfile = None
     for onefile in filelist:
         if 'atom_symbols' in onefile:
             atomsymbolsfile = os.path.join(dir, onefile)
     #Read the atom types from the atoms symbol file
     f = open(atomsymbolsfile)
     atomslist = list()
     for line in f.readlines():
         atomslist.append(line.strip())
     f.close()
     atms = read_lammps_data(myfilepath,atomslist)
     return AseAtomsAdaptor.get_structure(atms)