Skip to content

Commit 5cdda8e

Browse files
committed
support for writing .pdb file of polydisperse configs
1 parent a679e5a commit 5cdda8e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

patchyAnalysisTools/trajectory.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,8 @@ def write_frame_pdb(self,file_name,write_bond_info=False):
546546
#TODO: each cluster = one residue?
547547
types = {0: 'N', 1: 'C', 2: 'O', 3: 'H', 4: 'S'}
548548

549+
max_type = np.amax(self.type)
550+
549551
f = open(file_name,'w')
550552

551553
# write cell info
@@ -563,7 +565,13 @@ def write_frame_pdb(self,file_name,write_bond_info=False):
563565
x = self.coordinates[i,0]
564566
y = self.coordinates[i,1]
565567
z = self.coordinates[i,2]
566-
el = types[self.type[i]]
568+
if max_type > 4:
569+
if self.type[i] > max_type - 3:
570+
el = 'N'
571+
else:
572+
el = 'C'
573+
else:
574+
el = types[self.type[i]]
567575
f.write(atom.format(i,el,"VAL","A",1,x,y,z,1,0,el))
568576

569577
f.close()

0 commit comments

Comments
 (0)