Skip to content

Commit 814a1e2

Browse files
authored
improve accuracy of sqm input coordinates (#325)
* improve accuracy of sqm input coordinates Coordinates with 4 digits are enough for energy calculation but not enough for energy minimization. * fix tests * increase the string length of the number
1 parent 1a421e6 commit 814a1e2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

dpdata/amber/sqm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ def make_sqm_in(data, fname=None, frame_idx=0, **kwargs):
9494
ret += " verbosity=4\n"
9595
ret += " /\n"
9696
for ii in range(len(data['atom_types'])):
97-
ret += "{:>4s}{:>6s}{:>14s}{:>14s}{:>14s}\n".format(
97+
ret += "{:>4s}{:>6s}{:>16s}{:>16s}{:>16s}\n".format(
9898
str(atomic_numbers[ii]),
9999
str(symbols[ii]),
100-
f"{data['coords'][frame_idx][ii, 0]:.4f}",
101-
f"{data['coords'][frame_idx][ii, 1]:.4f}",
102-
f"{data['coords'][frame_idx][ii, 2]:.4f}"
100+
f"{data['coords'][frame_idx][ii, 0]:.6f}",
101+
f"{data['coords'][frame_idx][ii, 1]:.6f}",
102+
f"{data['coords'][frame_idx][ii, 2]:.6f}"
103103
)
104104
if fname is not None:
105105
with open(fname, 'w') as fp:

tests/amber/sqm.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Run semi-emperical minimization
55
maxcyc=0
66
verbosity=4
77
/
8-
6 C -0.0221 0.0032 0.0165
9-
1 H -0.6690 0.8894 -0.1009
10-
1 H -0.3778 -0.8578 -0.5883
11-
1 H 0.0964 -0.3151 1.0638
12-
1 H 0.9725 0.2803 -0.3911
8+
6 C -0.022100 0.003200 0.016500
9+
1 H -0.669000 0.889400 -0.100900
10+
1 H -0.377800 -0.857800 -0.588300
11+
1 H 0.096400 -0.315100 1.063800
12+
1 H 0.972500 0.280300 -0.391100

0 commit comments

Comments
 (0)