Previous topic

BigDFT.Logfiles module

Next topic

BigDFT.Calculators module

This Page

BigDFT.Fragments module

This module is related to the usage of BigDFT with Fragment-related Quantities. Input as well as Logfiles might be processed with the classes and methods provided by it.

BigDFT.Fragments.AU_to_A = 0.52917721092

Conversion between Atomic Units and Bohr

BigDFT.Fragments.CreateFragDict(start)[source]
BigDFT.Fragments.CreateFragList(frag_dict, merge_list=None)[source]
BigDFT.Fragments.Debye_to_AU = 0.393430307

Conversion between Debye and Atomic units

class BigDFT.Fragments.Fragment(atomlist=None, id='Unknown', units='AU')[source]

Introduce the concept of fragment. This is a subportion of the system (it may also coincide with the system itself) that is made of atoms. Such fragment might have quantities associated to it, like its electrostatic multipoles (charge, dipole, etc.) and also geometrical information (center of mass, principla axis etc.). A Fragment might also be rototranslated and combined with other moieteies to form a System.

Parameters:
  • atomlist (list-type) – list of atomic dictionaries defining the fragment
  • id (string) – label of the fragment
  • units (string) – the units of the fragment, can be ‘AU’ or ‘A’
Example:
>>> f = Fragment(atomlist) #provide the list of atomic dictionaries
>>> # or otherwise:
>>> f = Fragment(units='A') #initialize the fragment
>>> f.append(atom) #add an atom according to the f.append spec
>>> ... # repeat that until the fragment is completed

Todo

Define and describe if this API is also suitable for solid-state fragments

Q(atom=None, order=0)[source]

Fragment Monopole, when the information is available.

If the set_fragment_multipoles routine has been called you can use this routine to get that information back out.

For Q0 you can also compute for just a subset of the atoms.

Parameters:
  • atom (list) – atoms to compute the charge from.
  • order (integer) – which multipole to return (0, 1, 2)

Todo

WD: I’m not sure in which circumstances one would like to pass the atom list. Maybe we can remove that option?

append(atom=None, sym=None, positions=None)[source]

Include an atom in the fragment.

Parameters:
  • atom (dictionary) – The dictionary of the atom. Should be provided in the yaml format of BigDFT atomic positions.
  • sym (string) – The symbol of the atom. Need positions when specified.
  • positions (list) – The atomic positions, given in fragment units.
center_of_charge(zion)[source]
centroid()[source]
d0(center=None)[source]

Fragment dipole, calculated only from the atomic charges

d1(center=None)[source]

Fragment dipole including the atomic dipoles

dict()[source]

Transform the fragment information into a dictionary ready to be put as external potential

element(atom)[source]

Provides the name of the element

ellipsoid(center=0.0)[source]
get_posinp(units='AU')[source]

Get a list of elements and positions describing this fragment that is suitable for putting in the posinp entry of an input file.

Parameters:units (str) – units to write
line_up()[source]

Align the principal axis of inertia of the fragments along the coordinate axis. Also shift the fragment such as its centroid is zero.

q0(atom)[source]

Provides the charge of the atom

q1(atom)[source]

Provides the dipole of the atom

rxyz(atom)[source]
set_fragment_multipoles(q0, q1, q2)[source]

Set the multipoles associated with an entire fragment.

Parameters:
  • q0 (list) – list of floats defining the 0th multipole.
  • q1 (list) – list of floats defining the 1st multipole.
  • q2 (list) – list of floats defining the 2nd multipole.
set_id(id)[source]
set_purity_indicator(pi)[source]
transform(Rt)[source]

Apply a rototranslation of the fragment positions

xyz(filename=None, units='atomic')[source]

Write the fragment positions in a xyz file

BigDFT.Fragments.GetFragTuple(id)[source]
BigDFT.Fragments.GetSymbol(atom)[source]

Provide the key which contains the positions

Parameters:atom (dictionary) – the dictionary describing the atom
Returns:atom symbol
Return type:string
class BigDFT.Fragments.Lattice(vectors)[source]

Defines the fundamental objects to deal with periodic systems

grid(origin=[0.0, 0.0, 0.0], extremes=None, radius=None)[source]

produces a set of translation vectors from a given origin

BigDFT.Fragments.MergeFragmentsTogether(frag_dict, merge_list)[source]
class BigDFT.Fragments.Rotation(R)[source]

Bases: BigDFT.Fragments.RotoTranslation

class BigDFT.Fragments.RotoTranslation(pos1, pos2)[source]

Define a transformation which can be applied to a group of atoms

dot(pos)[source]

Apply the rototranslations on the set of positions provided by pos

invert()[source]
BigDFT.Fragments.SetFragId(name, fragid)[source]
class BigDFT.Fragments.System(mp_dict=None, xyz=None, nat_reference=None, units='AU', transformations=None, reference_fragments=None, posinp_dict=None, frag_partition=None)[source]

A system is defined by a collection of Fragments.

It might be given by one single fragment

Parameters:
  • mp_dict (dict) –
  • xyz (str) –
  • nat_reference (int) –
  • units (str) –
  • () (posinp_dict) –
  • ()
  • ()
  • frag_partition (list) – A list of integers which define the partitioning of a system. For example, a system with fragments [a, b, c, d] will be split in to [[a], [b, c], [d]] if passed the following list: [1, 3, 5].
Q()[source]

Provides the global monopole of the system given as a sum of the monopoles of the atoms

append(frag)[source]

Append a fragment to the System class

central_fragment()[source]

Returns the fragment whose center of mass is closest to the centroid

centroid()[source]

Center of mass of the system

decompose(reference_fragments)[source]

Decompose the system into reference fragments

dict(filename=None)[source]
fill_from_mp_dict(mpd, nat_reference=None, frag_partition=None)[source]

Fill the System from a dictionary of multipole coefficients

mpd (dict) : multipole dictionary to build from. nat_reference (int) : specifies an even partitioning of the system. frag_partition (list):

A list of integers which define the partitioning of a system. For example, a system with fragments [a, b, c, d] will be split in to [[a], [b, c], [d]] if passed the following list: [1, 3, 5].
fill_from_posinp_dict(dct)[source]
fill_from_xyz(file, nat_reference)[source]

Import the fragment information from a xyz file

fragdict()[source]

Provides the value of the dictionary fragment to be used for the inputfile in a fragment calculation

fragment_transformation(frag1, frag2)[source]

returns the transformation among fragments if exists

pop(ifrag)[source]

Pop the fragment ifrag from the list of fragments

recompose(transformations=None, reference_fragments=None)[source]

Rebuild the system from a set of transformations

write_fragfile(filename='log.yaml')[source]

Create a fragment list file and write it to the disk.

Parameters:filename (string) – the name of the file to write to.
xyz(filename=None, units='atomic')[source]
class BigDFT.Fragments.Translation(t)[source]

Bases: BigDFT.Fragments.RotoTranslation

class BigDFT.Fragments.XYZfile(filename=None, units='atomic')[source]

A class associated to a xyz input file as processed by BigDFT

Parameters:
  • filename (string) – The file which will be created. If None, the file will be eventually dumped in :class:~`sys.stdout`.
  • units (string) – The units of measure of the positions. Allowed avlues are ‘atomic’ or ‘angstroem’
append(array, basename='', names=None, attributes=None)[source]

Add lines to the file position list

Parameters:
  • array (list of float triples) – list of the atomic positions
  • basename (string) – base for the name of the atoms
  • names (list of strings) – list of atom names. Will be appended to basename if the latter is present
  • attributes (list of dictionaries) – list of further attributes to be associated to each of the atoms. Will be serialized close to each of the atomic positions
dump(position='w')[source]

Dump the file on the file system if filename has been provided, otherwise dump on sys.stdout.

Parameters:position (char) – filename position statement. Only menaingful for a file dumping.
BigDFT.Fragments.build_transformations(RTlist, ref)[source]

Build the transformation list to be passed to the systems’ creation via the transformation keyword

BigDFT.Fragments.close_xyz(f, filename)[source]
BigDFT.Fragments.distance(i, j, cell=None)[source]

Distance between fragments, defined as distance between center of mass

BigDFT.Fragments.dump_xyz(array, basename='', units='atomic', names=None, filename=None, position='a', comment=None, cell=None)[source]

Create a BigDFT xyz filename. Duplicates the meaning of the XYZfile class.

Parameters:filename (string) – The file which will be created. If None, the file will be eventually dumped in :class:~`sys.stdout`.

Todo

Remove the duplication of operations in favour or the class. Move the related operation into a lower-level module.

BigDFT.Fragments.dump_xyz_positions(f, array, basename='', names=None)[source]
BigDFT.Fragments.find_reference_fragment(refs, transformed)[source]

generate the list of fragments that are associates to a given list of templates

BigDFT.Fragments.frag_average(ref, flist, clean_monopole=True)[source]

Perform the average in attributes of the fragments provided by the list, with the position of the first fragment

BigDFT.Fragments.open_xyz(filename, nat, unit, comment, position='a')[source]
BigDFT.Fragments.prepare_fragment_inputs(name, directory='.', flavour='Isolated', system=None, template=None, template_dir=None, template_name=None)[source]
BigDFT.Fragments.rotot_collection(ref_frag, lookup, fragments)[source]

Deprecated routine, only for backward compatibility

BigDFT.Fragments.wahba_fragment(frag1, frag2)[source]

Solve the wahba’s problem among fragments, deprecated routine

BigDFT.Fragments.xyz_bc_spec(cell)[source]

Defines the specification for expressing the Boundary Conditions starting from a cell vector.

Parameters:cell (triple of floats or None) – array of the (orthorhombic) cell. Should be 0.0 on directions with free BC. If None is given, the BC are assumed to be Free.
Returns:comment Line of the xyz file specifying the bc
Return type:string