From d53cec74f8d748144dfa41f411b836f0b8f5c2b7 Mon Sep 17 00:00:00 2001 From: Gani Annaberdiyev Date: Tue, 8 Oct 2024 13:52:26 -0700 Subject: [PATCH 1/4] organize qdens corner input --- nexus/bin/qdens | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/nexus/bin/qdens b/nexus/bin/qdens index aff3dc9b75..252b8b2110 100755 --- a/nexus/bin/qdens +++ b/nexus/bin/qdens @@ -309,8 +309,8 @@ class SingleDensity(QDBase): self.check_type('grid' ,grid ,'tuple/list/ndarray',(tuple,list,np.ndarray)) self.check_type('structure',structure,'Structure' ,Structure) self.check_type('extension',extension,'string' ,str) - self.check_type('density_cell' ,grid ,'tuple/list/ndarray',(tuple,list,np.ndarray)) - self.check_type('density_corner',grid ,'tuple/list/ndarray',(tuple,list,np.ndarray)) + self.check_type('density_cell' ,grid,'tuple/list/ndarray',(tuple,list,np.ndarray)) + self.check_type('density_corner',grid,'tuple/list/ndarray',(tuple,list,np.ndarray)) # process other inputs if mean is not None: self.mean = np.array(mean,dtype=float) @@ -335,19 +335,12 @@ class SingleDensity(QDBase): self._error('inputted density_corner must have length 3, received {0}'.format(density_corner)) #end if self.density_corner = np.array(density_corner,dtype=float) - else: - self.density_corner = np.zeros(3) # If density_corner is not given, use [0, 0, 0] as corner #end if if density_cell is not None: if len(np.array(density_cell).ravel())!=9: self._error('inputted density_cell must have length 9, received {0}'.format(density_cell)) #end if self.density_cell = np.array(density_cell,dtype=float) - else: - # If density_cell is not given, use the structure cell - s = self.structure.copy() - s.change_units('A') - self.density_cell = s.axes #end if if data is not None: self.analyze(data) @@ -1130,10 +1123,17 @@ class QMCDensityProcessor(QDBase): if 'cell' in sd: density_cell = sd.cell.copy() density_cell = convert(density_cell, 'B', 'A') + else: + # If density_cell is not given, use the structure cell + dens_struct = structure.copy() + dens_struct.change_units('A') + density_cell = dens_struct.axes #end if if 'corner' in sd: density_corner = sd.corner.copy() density_corner = convert(density_corner, 'B', 'A') + else: + density_corner = np.zeros(3) # If density_corner is not given, use [0, 0, 0] as corner #end if elif name not in grids and isinstance(xml,density_xml): sd = xml @@ -1222,9 +1222,9 @@ class QMCDensityProcessor(QDBase): if opt.density_corner is not None: density_corner = input_list(opt.density_corner) try: - density_corner = np.array(density_corner,dtype=int) + density_corner = np.array(density_corner,dtype=float) except: - self.error('--density_corner input misformatted\nexpected a list of integers\nreceived: {0}'.format(density_corner)) + self.error('--density_corner input misformatted\nexpected a list of floats\nreceived: {0}'.format(density_corner)) #end try if len(density_corner)!=3: self.error('--density_corner input misformatted\nexpected 3 elements\nreceived {0} elements with values: {1}'.format(len(density_corner),density_corner)) From 86fcfb3cfa070526fc8bda871ecc38f0e777d648 Mon Sep 17 00:00:00 2001 From: Gani Annaberdiyev Date: Mon, 14 Oct 2024 13:12:03 -0700 Subject: [PATCH 2/4] handle one-specie SOC J3 --- nexus/lib/qmcpack.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/nexus/lib/qmcpack.py b/nexus/lib/qmcpack.py index 5fbb400e19..ac8eae0237 100644 --- a/nexus/lib/qmcpack.py +++ b/nexus/lib/qmcpack.py @@ -931,16 +931,19 @@ def incorporate_result(self,result_name,result,sim): J3 = optwf.get('J3') if J3 is not None: corr = J3.get('correlation') - j3_ids = [] - for j3_term in corr: - j3_id = j3_term.coefficients.id - j3_ids.append(j3_id) - #end for - for j3_id in j3_ids: - if 'ud' in j3_id: - delattr(corr, j3_id) - #end if - #end for + if hasattr(corr, 'coefficients'): + pass + else: + j3_ids = [] + for j3_term in corr: + j3_id = j3_term.coefficients.id + j3_ids.append(j3_id) + #end for + for j3_id in j3_ids: + if 'ud' in j3_id: + delattr(corr, j3_id) + #end if + #end for #end if #end if def process_jastrow(wf): From d957cc0d8fff78e0b3444b90d418aac4d3c62e4a Mon Sep 17 00:00:00 2001 From: Gani Annaberdiyev Date: Tue, 15 Oct 2024 06:55:33 -0700 Subject: [PATCH 3/4] check uu --- nexus/lib/qmcpack.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nexus/lib/qmcpack.py b/nexus/lib/qmcpack.py index ac8eae0237..e4e225e1a0 100644 --- a/nexus/lib/qmcpack.py +++ b/nexus/lib/qmcpack.py @@ -932,7 +932,10 @@ def incorporate_result(self,result_name,result,sim): if J3 is not None: corr = J3.get('correlation') if hasattr(corr, 'coefficients'): - pass + # For single-species systems, the data structure changes. + # In this case, the only J3 term should be 'uu'. + # Otherwise, the user might be trying to do something strange. + assert 'uu' in corr.coefficients.id, 'Only uu J3 terms are allowed in SOC calculations.' else: j3_ids = [] for j3_term in corr: From ada9f8587050060e8586c0018f3e5362c9528ca4 Mon Sep 17 00:00:00 2001 From: Gani Annaberdiyev Date: Tue, 15 Oct 2024 08:35:22 -0700 Subject: [PATCH 4/4] block cell and corner keywords --- nexus/bin/qdens | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nexus/bin/qdens b/nexus/bin/qdens index 252b8b2110..35ac2e7130 100755 --- a/nexus/bin/qdens +++ b/nexus/bin/qdens @@ -1121,6 +1121,7 @@ class QMCDensityProcessor(QDBase): self.error('could not identify grid data for spin density named "{0}"\bin QMCPACK input file: {1}'.format(name,opt.input)) #end if if 'cell' in sd: + self.error('Currently, the cell keyword is not supported due to a bug: See https://github.com/QMCPACK/qmcpack/issues/5201') density_cell = sd.cell.copy() density_cell = convert(density_cell, 'B', 'A') else: @@ -1130,6 +1131,7 @@ class QMCDensityProcessor(QDBase): density_cell = dens_struct.axes #end if if 'corner' in sd: + self.error('Currently, the corner keyword is not supported due to a bug: See https://github.com/QMCPACK/qmcpack/issues/5201') density_corner = sd.corner.copy() density_corner = convert(density_corner, 'B', 'A') else: @@ -1203,6 +1205,7 @@ class QMCDensityProcessor(QDBase): # --density_cell option if opt.density_cell is not None: + self.error('Currently, the cell keyword is not supported due to a bug: See https://github.com/QMCPACK/qmcpack/issues/5201') density_cell = input_list(opt.density_cell) try: density_cell = np.array(density_cell,dtype=float) @@ -1220,6 +1223,7 @@ class QMCDensityProcessor(QDBase): # --density_corner option if opt.density_corner is not None: + self.error('Currently, the corner keyword is not supported due to a bug: See https://github.com/QMCPACK/qmcpack/issues/5201') density_corner = input_list(opt.density_corner) try: density_corner = np.array(density_corner,dtype=float)