Skip to content

Commit

Permalink
Merge pull request #11 from PytLab/add-poscar-cartesian-coordinate
Browse files Browse the repository at this point in the history
Add cartesian coord in get_poscar_content
  • Loading branch information
PytLab authored Feb 20, 2019
2 parents ecb6f47 + de7931b commit c0bd98c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions vaspy/atomco.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,14 @@ def get_poscar_content(self, **kwargs):
atom_types = ("{:>5s}"*len(types) + "\n").format(*types)
atom_numbers = ("{:>5d}"*len(numbers) + "\n").format(*numbers)

# Direct or Cartesian
coord_type = kwargs.get('coord_type', 'direct')

# string
info = "Selective Dynamics\nDirect\n"
if coord_type == 'direct':
info = "Selective Dynamics\nDirect\n"
else:
info = "Cartensian\n"

# data and tf
try:
Expand All @@ -170,7 +176,12 @@ def get_poscar_content(self, **kwargs):
default_tf = np.full(self.data.shape, 'T', dtype=np.str)
tf = kwargs.get("tf", default_tf)
data_tf = ''
for data, tf in zip(self.data.tolist(), tf.tolist()):
if coord_type == 'direct':
data = self.data.tolist()
else:
data = self.dir2cart(self.bases, self.data).tolist()

for data, tf in zip(data, tf.tolist()):
data_tf += ("{:18.12f}"*3 + "{:>5s}"*3 + "\n").format(*(data+tf))

# merge all strings
Expand Down

0 comments on commit c0bd98c

Please sign in to comment.