def __init__(self, lmp_, input_file_=None): self.num_atoms = lmp_.extract_global("natoms", 0) self.num_atom_types = [] self.atom_types = [] self.initial_positions = pos_to_array(lmp_) self.positions_store = pos_to_array(lmp_) self.positions = pos_to_array(lmp_) if input_file_ == None: print "No input file defined in atoms system" exit() else: """ Assign atom types. """ data_file = get_data_file(input_file_) print "Obtaining atom types from " + data_file with open(data_file) as f: content = f.readlines() types_array = get_atom_types(input_file_) self.num_atom_types = int(str.split(content[3])[0]) print str(self.num_atom_types) + " found of type:" print types_array for i in range(self.num_atoms): atom_type = int( str.split(content[14 + (self.num_atom_types) + i])[1]) self.atom_types.append(types_array[atom_type - 1]) print "Atom types are as follows:" print self.atom_types print "\n"
def __init__(self, lmp_, input_file_ = None): self.num_atoms = lmp_.extract_global("natoms", 0) self.num_atom_types = [] self.atom_types = [] self.initial_positions = pos_to_array(lmp_) self.positions_store = pos_to_array(lmp_) self.positions = pos_to_array(lmp_) if input_file_ == None: print "No input file defined in atoms system" exit() else: """ Assign atom types. """ data_file = get_data_file(input_file_) print "Obtaining atom types from " + data_file with open(data_file) as f: content = f.readlines() types_array=get_atom_types(input_file_) self.num_atom_types = int(str.split(content[3])[0]) print str(self.num_atom_types) + " found of type:" print types_array for i in range(self.num_atoms): atom_type = int(str.split(content[14+(self.num_atom_types)+i])[1]) self.atom_types.append(types_array[atom_type-1]) print "Atom types are as follows:" print self.atom_types print "\n"
def assign_atom_types(self, input_file_): """ Assign atom types. """ data_file = get_data_file(input_file_) print "Obtaining atom types from " + data_file with open(data_file) as f: content = f.readlines() types_array=get_atom_types(input_file_) self.num_atom_types = int(str.split(content[3])[0]) print str(self.num_atom_types) + " found of type:" print types_array for i in range(self.num_atoms): atom_type = int(str.split(content[14+(self.num_atom_types)+i])[1]) self.atom_types.append(types_array[atom_type-1]) print "Atom types are as follows:" print self.atom_types print "\n"
def assign_atom_types(self, input_file_): """ Assign atom types. """ data_file = get_data_file(input_file_) print "Obtaining atom types from " + data_file with open(data_file) as f: content = f.readlines() types_array = get_atom_types(input_file_) self.num_atom_types = int(str.split(content[3])[0]) print str(self.num_atom_types) + " found of type:" print types_array for i in range(self.num_atoms): atom_type = int( str.split(content[14 + (self.num_atom_types) + i])[1]) self.atom_types.append(types_array[atom_type - 1]) print "Atom types are as follows:" print self.atom_types print "\n"