From 1d3ff35ec8e03716ce90bc6d033911fc26df53fb Mon Sep 17 00:00:00 2001 From: Alberto Otero de la Roza Date: Mon, 19 Feb 2024 10:34:23 +0100 Subject: [PATCH] improve newcell for large size transformations: use Cartesian for comparison --- src/crystalmod@edit.f90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/crystalmod@edit.f90 b/src/crystalmod@edit.f90 index 2ba006f1..3725b65c 100644 --- a/src/crystalmod@edit.f90 +++ b/src/crystalmod@edit.f90 @@ -124,6 +124,7 @@ module subroutine newcell(c,x00,t0,nnew,xnew,isnew,noenv,ti) real*8, allocatable :: xlat(:,:) real*8, parameter :: eps = 1d-2 + real*8, parameter :: eps2 = eps * eps if (c%ismolecule) & call ferror('newcell','NEWCELL incompatible with molecules',faterr) @@ -251,8 +252,8 @@ module subroutine newcell(c,x00,t0,nnew,xnew,isnew,noenv,ti) ok = .true. do m = 1, ncseed%nat dx = x - ncseed%x(:,m) - dx = abs(dx - nint(dx)) - if (all(dx < eps)) then + dx = matmul(ncseed%m_x2c,dx - nint(dx)) + if (dot_product(dx,dx) < eps2) then ok = .false. exit end if