Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nexus/nexus/gamess.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def incorporate_result(self,result_name,result,sim):
self.block()
#end if
guess_inputs = obj()
ecounts = self.system.particles.electron_counts()
ecounts = self.system.electron_counts()
Comment thread
jtkrogel marked this conversation as resolved.
Outdated
orbs = result.orbitals
order_map = obj(up='iorder',down='jorder')
nelec_map = obj(up=ecounts[0],down=ecounts[1])
Expand Down
22 changes: 22 additions & 0 deletions nexus/nexus/physical_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,28 @@ def kf_rpa(self):
kfs = [(3*nelec*kvol1/(4*np.pi))**(1./3) for nelec in nelecs]
return np.array(kfs)
#end def kf_rpa


def electron_counts(self):
Comment thread
jtkrogel marked this conversation as resolved.
Outdated
return self.particles.electron_counts()

def count_electrons(self):
return self.particles.count_electrons()

def count_ions(self, species=False):
Comment thread
jtkrogel marked this conversation as resolved.
Outdated
return self.particles.count_ions(species)

def get_ions(self):
Comment thread
jtkrogel marked this conversation as resolved.
Outdated
return self.particles.get_ions()

@property
def up_electron(self):
Comment thread
jtkrogel marked this conversation as resolved.
Outdated
return self.particles.up_electron

@property
Comment thread
jtkrogel marked this conversation as resolved.
def down_electron(self):
return self.particles.down_electron

#end class PhysicalSystem


Expand Down
24 changes: 11 additions & 13 deletions nexus/nexus/pwscf_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -1675,17 +1675,16 @@ def incorporate_system(self,system,elem_order=None):
system.check_folded_system()
system.update_particles()
system.change_units('B')
p = system.particles
s = system.structure
nc = system.net_charge
ns = system.net_spin

nup = p.up_electron.count
ndn = p.down_electron.count
nup = system.up_electron.count

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system.nup and system.ndown

ndn = system.down_electron.count

self.system.ibrav = 0
# self.system['celldm(1)'] = 1.0e0
nions,nspecies = p.count_ions(species=True)
nions,nspecies = system.count_ions(species=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system.nions and system.nspecies

self.system.nat = nions
self.system.ntyp = nspecies
self.system.tot_charge = nc
Expand Down Expand Up @@ -1717,7 +1716,7 @@ def incorporate_system(self,system,elem_order=None):
#end if
#end if

atoms = p.get_ions()
atoms = system.get_ions()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

masses = system.ion_masses

if 'masses' not in self.atomic_species:
self.atomic_species.masses = obj()
#end if
Expand All @@ -1739,7 +1738,7 @@ def incorporate_system(self,system,elem_order=None):
pp = self.atomic_species.pseudopotentials
for atom in self.atomic_species.atoms:
if atom not in pp:
iselem,symbol = p.is_element(atom,symbol=True)
iselem,symbol = system.is_element(atom,symbol=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Elements.is_element

if iselem and symbol in pp:
pp[atom] = str(pp[symbol])
#end if
Expand Down Expand Up @@ -1770,17 +1769,16 @@ def incorporate_system_old(self,system,spin_polarized=None):
system.check_folded_system()
system.update_particles()
system.change_units('B')
p = system.particles
s = system.structure
nc = system.net_charge
ns = system.net_spin

nup = p.up_electron.count
ndn = p.down_electron.count
nup = system.up_electron.count

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system.nup and system.ndown

ndn = system.down_electron.count

self.system.ibrav = 0
# self.system['celldm(1)'] = 1.0e0
nions,nspecies = p.count_ions(species=True)
nions,nspecies = system.count_ions(species=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system.nions and system.nspecies

self.system.nat = nions
self.system.ntyp = nspecies
#self.system.nelec = nup+ndn
Expand Down Expand Up @@ -1819,7 +1817,7 @@ def incorporate_system_old(self,system,spin_polarized=None):
#end if
#end if

atoms = p.get_ions()
atoms = system.get_ions()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

masses = system.ion_masses

masses = obj()
for name,a in atoms.items():
masses[name] = convert(a.mass,'me','amu')
Expand All @@ -1830,7 +1828,7 @@ def incorporate_system_old(self,system,spin_polarized=None):
pp = self.atomic_species.pseudopotentials
for atom in self.atomic_species.atoms:
if atom not in pp:
iselem,symbol = p.is_element(atom,symbol=True)
iselem,symbol = system.is_element(atom,symbol=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Elements.is_element

if iselem and symbol in pp:
pp[atom] = str(pp[symbol])
#end if
Expand Down Expand Up @@ -2265,7 +2263,7 @@ def generate_any_pwscf_input(**kwargs):

# set nbnd using bandfac, if provided
if nbnd is None and bandfac is not None:
nocc = max(system.particles.electron_counts())
nocc = max(system.electron_counts())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nocc = max(system.nup,system.ndown)

pw.system.nbnd = int(np.ceil(nocc*bandfac))
#end if

Expand Down
16 changes: 8 additions & 8 deletions nexus/nexus/qmcpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ def unfolded_nelecs(self):
Returns the number of electrons in the primitive cell
'''
if self.system.folded_system is None:
n_up = self.system.particles.up_electron.count
n_dn = self.system.particles.down_electron.count
n_up = self.system.up_electron.count

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system.nup and system.ndown

n_dn = self.system.down_electron.count
else:
n_up = self.system.folded_system.particles.up_electron.count
n_dn = self.system.folded_system.particles.down_electron.count
n_up = self.system.folded_system.up_electron.count

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

folded_system.nup and folded_system.ndown

n_dn = self.system.folded_system.down_electron.count
#end if
nelecs = n_up + n_dn
return nelecs
Expand Down Expand Up @@ -463,8 +463,8 @@ def sum_charge_twists(self):
'''
Returns the net charge of a system with multiple twists (not averaged)
'''
n_up = self.system.particles.up_electron.count
n_dn = self.system.particles.down_electron.count
n_up = self.system.up_electron.count

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system.nup and system.ndown

n_dn = self.system.down_electron.count
n_total = n_up + n_dn
nelecs_at_twist = self.nelecs_at_twist
kweights = np.array(self.system.structure.kweights)
Expand Down Expand Up @@ -536,8 +536,8 @@ def write_gcta_report(self, locdir, fermi_level, scf_magnet = None):
spin_sum_twists = self.sum_spin_twists()
qmc_magnet = spin_sum_twists / nosym_kpoints
#end if
n_up = self.system.particles.up_electron.count
n_dn = self.system.particles.down_electron.count
n_up = self.system.up_electron.count

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

system.nup and system.ndown

n_dn = self.system.down_electron.count
n_total = n_up + n_dn
nelecs_at_twist = self.nelecs_at_twist
fermi_level = np.array(fermi_level)
Expand Down
Loading
Loading